diff --git a/js/apps/admin-ui/src/clients/routes/NewRole.tsx b/js/apps/admin-ui/src/clients/routes/NewRole.tsx index 0015c5f0812..c492fcaeeb5 100644 --- a/js/apps/admin-ui/src/clients/routes/NewRole.tsx +++ b/js/apps/admin-ui/src/clients/routes/NewRole.tsx @@ -12,7 +12,7 @@ export const NewRoleRoute: AppRouteObject = { element: , breadcrumb: (t) => t("createRole"), handle: { - access: "manage-clients", + access: "query-clients", }, }; diff --git a/js/apps/admin-ui/src/components/role-form/RoleForm.tsx b/js/apps/admin-ui/src/components/role-form/RoleForm.tsx index 2acf1a68368..99bdf3bb71d 100644 --- a/js/apps/admin-ui/src/components/role-form/RoleForm.tsx +++ b/js/apps/admin-ui/src/components/role-form/RoleForm.tsx @@ -52,6 +52,7 @@ export const RoleForm = ({ onSubmit={handleSubmit(onSubmit)} role={role} className="pf-u-mt-lg" + fineGrainedAccess={true} // We would never want to show this form in read-only mode > { const { attributes, ...rest } = role; @@ -117,6 +126,14 @@ export default function RealmRoleTabs() { [key], ); + useFetch( + async () => adminClient.clients.findOne({ id: clientId }), + (client) => { + if (clientId) setCanManageClientRole(client?.access?.manage as boolean); + }, + [], + ); + const onSubmit: SubmitHandler = async (formValues) => { try { const { attributes, ...rest } = formValues; @@ -375,6 +392,7 @@ export default function RealmRoleTabs() { setValue("attributes", attributes, { shouldDirty: false }) } @@ -389,14 +407,15 @@ export default function RealmRoleTabs() { )} - {isFeatureEnabled(Feature.AdminFineGrainedAuthz) && ( - {t("permissions")}} - {...permissionsTab} - > - - - )} + {isFeatureEnabled(Feature.AdminFineGrainedAuthz) && + canViewPermissionsTab && ( + {t("permissions")}} + {...permissionsTab} + > + + + )}