File tree 4 files changed +162
-154
lines changed
pages/ManagementSettingsPage/CustomRolesPage
4 files changed +162
-154
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ export const checks = {
17
17
viewAnyGroup : "viewAnyGroup" ,
18
18
createGroup : "createGroup" ,
19
19
viewAllLicenses : "viewAllLicenses" ,
20
+ assignOrgRole : "assignOrgRole" ,
20
21
} as const ;
21
22
22
23
export const permissionsToCheck = {
@@ -131,6 +132,12 @@ export const permissionsToCheck = {
131
132
} ,
132
133
action : "read" ,
133
134
} ,
135
+ [ checks . assignOrgRole ] : {
136
+ object : {
137
+ resource_type : "assign_org_role" ,
138
+ } ,
139
+ action : "create" ,
140
+ } ,
134
141
} as const ;
135
142
136
143
export type Permissions = Record < keyof typeof permissionsToCheck , boolean > ;
Original file line number Diff line number Diff line change @@ -22,10 +22,10 @@ import CustomRolesPageView from "./CustomRolesPageView";
22
22
23
23
export const CustomRolesPage : FC = ( ) => {
24
24
const { permissions } = useAuthenticated ( ) ;
25
- const { createGroup : canCreateGroup } = permissions ;
25
+ const { assignOrgRole : canAssignOrgRole } = permissions ;
26
26
const {
27
27
multiple_organizations : organizationsEnabled ,
28
- template_rbac : isTemplateRBACEnabled ,
28
+ custom_roles : isCustomRolesEnabled ,
29
29
} = useFeatureVisibility ( ) ;
30
30
const { experiments } = useDashboard ( ) ;
31
31
const location = useLocation ( ) ;
@@ -62,7 +62,7 @@ export const CustomRolesPage: FC = () => {
62
62
< PageHeader
63
63
actions = {
64
64
< >
65
- { canCreateGroup && isTemplateRBACEnabled && (
65
+ { canAssignOrgRole && isCustomRolesEnabled && (
66
66
< Button
67
67
component = { RouterLink }
68
68
startIcon = { < GroupAdd /> }
@@ -79,8 +79,8 @@ export const CustomRolesPage: FC = () => {
79
79
80
80
< CustomRolesPageView
81
81
roles = { organizationRolesQuery . data }
82
- canCreateGroup = { canCreateGroup }
83
- isTemplateRBACEnabled = { isTemplateRBACEnabled }
82
+ canAssignOrgRole = { canAssignOrgRole }
83
+ isCustomRolesEnabled = { isCustomRolesEnabled }
84
84
/>
85
85
</ >
86
86
) ;
Original file line number Diff line number Diff line change @@ -29,25 +29,25 @@ import { docs } from "utils/docs";
29
29
30
30
export type CustomRolesPageViewProps = {
31
31
roles : Role [ ] | undefined ;
32
- canCreateGroup : boolean ;
33
- isTemplateRBACEnabled : boolean ;
32
+ canAssignOrgRole : boolean ;
33
+ isCustomRolesEnabled : boolean ;
34
34
} ;
35
35
36
36
// const filter = createFilterOptions<Role>();
37
37
38
38
export const CustomRolesPageView : FC < CustomRolesPageViewProps > = ( {
39
39
roles,
40
- canCreateGroup ,
41
- isTemplateRBACEnabled ,
40
+ canAssignOrgRole ,
41
+ isCustomRolesEnabled ,
42
42
} ) => {
43
43
const isLoading = Boolean ( roles === undefined ) ;
44
44
const isEmpty = Boolean ( roles && roles . length === 0 ) ;
45
45
// const [selectedRole, setSelectedRole] = useState<Role | null>(null);
46
-
46
+ console . log ( { roles } ) ;
47
47
return (
48
48
< >
49
49
< ChooseOne >
50
- < Cond condition = { ! isTemplateRBACEnabled } >
50
+ < Cond condition = { ! isCustomRolesEnabled } >
51
51
< Paywall
52
52
message = "Custom Roles"
53
53
description = "Organize users into groups with restricted access to templates. You need an Enterprise license to use this feature."
@@ -77,19 +77,19 @@ export const CustomRolesPageView: FC<CustomRolesPageViewProps> = ({
77
77
< EmptyState
78
78
message = "No groups yet"
79
79
description = {
80
- canCreateGroup
81
- ? "Create your first group "
82
- : "You don't have permission to create a group "
80
+ canAssignOrgRole
81
+ ? "Create your first custom role "
82
+ : "You don't have permission to create a custom role "
83
83
}
84
84
cta = {
85
- canCreateGroup && (
85
+ canAssignOrgRole && (
86
86
< Button
87
87
component = { RouterLink }
88
88
to = "create"
89
89
startIcon = { < AddOutlined /> }
90
90
variant = "contained"
91
91
>
92
- Create group
92
+ Create custom role
93
93
</ Button >
94
94
)
95
95
}
You can’t perform that action at this time.
0 commit comments