Skip to content

feat: add custom roles #14069

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 28 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
1b450da
feat: initial commit custom roles
jaaydenh Jul 31, 2024
e3647cb
feat: add page to create and edit custom roles
jaaydenh Jul 31, 2024
14f7bfc
feat: add assign org role permission
jaaydenh Aug 1, 2024
928de7e
feat: wip
jaaydenh Aug 2, 2024
8ebfee7
feat: cleanup
jaaydenh Aug 2, 2024
cb870e1
fix: role name is disabled when editing the role
jaaydenh Aug 2, 2024
6dff9ed
fix: assign role context menu falls back to name when no display_name
jaaydenh Aug 2, 2024
688ab79
feat: add helper text to let users know that role name is immutable
jaaydenh Aug 2, 2024
68eae17
fix: format
jaaydenh Aug 2, 2024
fbea545
feat: - hide custom roles tab if experiment is not enabled
jaaydenh Aug 2, 2024
b4a460f
fix: use custom TableLoader
jaaydenh Aug 2, 2024
832573f
fix: fix custom roles text
jaaydenh Aug 2, 2024
a5415c5
fix: use PatchRoleRequest
jaaydenh Aug 2, 2024
8db1da0
fix: use addIcon to create roles
jaaydenh Aug 2, 2024
4e05a33
feat: add cancel and save buttons to top of page
jaaydenh Aug 2, 2024
a17f579
fix: use nameValidator for name
jaaydenh Aug 4, 2024
e9af2f9
chore: cleanup
jaaydenh Aug 5, 2024
e40f0bf
feat: add show all permissions checkbox
jaaydenh Aug 6, 2024
add45fb
fix: update sidebar for roles
jaaydenh Aug 6, 2024
dfe82b1
fix: fix format
jaaydenh Aug 6, 2024
f623356
fix: custom roles is not needed outside orgs
jaaydenh Aug 6, 2024
f7860aa
fix: fix sidebar stories
jaaydenh Aug 6, 2024
764b15f
feat: add custom roles page stories
jaaydenh Aug 6, 2024
124090b
fix: use organization permissions
jaaydenh Aug 7, 2024
11db948
feat: add stories for CreateEditRolePageView
jaaydenh Aug 8, 2024
e18bf46
fix: design improvements for the create edit role form
jaaydenh Aug 8, 2024
d455c4e
feat: add show all resources checkbox to bottom of table
jaaydenh Aug 9, 2024
72f1bab
feat: improve spacing
jaaydenh Aug 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: add custom roles page stories
  • Loading branch information
jaaydenh committed Aug 6, 2024
commit 764b15fc603a04456b08eaadfde5e8b53f082043
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import type { Meta, StoryObj } from "@storybook/react";
import { MockRole } from "testHelpers/entities";
import { CustomRolesPageView } from "./CustomRolesPageView";

const meta: Meta<typeof CustomRolesPageView> = {
title: "pages/OrganizationCustomRolesPage",
component: CustomRolesPageView,
};

export default meta;
type Story = StoryObj<typeof CustomRolesPageView>;

export const NotEnabled: Story = {
args: {
roles: [MockRole],
canAssignOrgRole: true,
isCustomRolesEnabled: false,
},
};

export const Enabled: Story = {
args: {
roles: [MockRole],
canAssignOrgRole: true,
isCustomRolesEnabled: true,
},
};

export const EmptyDisplayName: Story = {
args: {
roles: [{ ...MockRole, name: "my-custom-role", display_name: "" }],
canAssignOrgRole: true,
isCustomRolesEnabled: true,
},
};

export const EmptyRoleWithoutPermission: Story = {
args: {
roles: [],
canAssignOrgRole: false,
isCustomRolesEnabled: true,
},
};

export const EmptyRoleWithPermission: Story = {
args: {
roles: [],
canAssignOrgRole: true,
isCustomRolesEnabled: true,
},
};
65 changes: 65 additions & 0 deletions site/src/testHelpers/entities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2425,6 +2425,71 @@ export const MockWorkspaceQuota: TypesGen.WorkspaceQuota = {
budget: 100,
};

export const MockRole: TypesGen.Role = {
name: "my-role-1",
display_name: "My Role 1",
organization_id: MockOrganization.id,
site_permissions: [],
organization_permissions: [
{
negate: false,
resource_type: "organization_member",
action: "create",
},
{
negate: false,
resource_type: "organization_member",
action: "delete",
},
{
negate: false,
resource_type: "organization_member",
action: "read",
},
{
negate: false,
resource_type: "organization_member",
action: "update",
},
{
negate: false,
resource_type: "template",
action: "create",
},
{
negate: false,
resource_type: "template",
action: "delete",
},
{
negate: false,
resource_type: "template",
action: "read",
},
{
negate: false,
resource_type: "template",
action: "update",
},
{
negate: false,
resource_type: "template",
action: "view_insights",
},
{
negate: false,
resource_type: "audit_log",
action: "create",
},
{
negate: false,
resource_type: "audit_log",
action: "read",
},
],
user_permissions: [],
};

export const MockGroup: TypesGen.Group = {
id: "fbd2116a-8961-4954-87ae-e4575bd29ce0",
name: "Front-End",
Expand Down
Loading