From ebf56dacc03d95c6c399dfcb316884f7b99a46a0 Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Thu, 28 Apr 2022 15:18:14 +0200 Subject: [PATCH] Initial version of the group permissions tab (#2519) --- public/resources/en/common.json | 2 ++ src/components/permission-tab/PermissionTab.tsx | 6 +++++- src/groups/GroupsSection.tsx | 8 ++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/public/resources/en/common.json b/public/resources/en/common.json index cdfe922300..aa5c801b56 100644 --- a/public/resources/en/common.json +++ b/public/resources/en/common.json @@ -91,6 +91,8 @@ "permissionsListIntro": "Edit the permission list by clicking the scope-name. It then redirects to the permission details page of the client named <1>{{realm}}", "usersPermissionsHint": "Fine grained permissions for managing all users in realm. You can define different policies for who is allowed to manage users in the realm.", "clientsPermissionsHint": "Fine grained permissions for administrators that want to manage this client or apply roles defined by this client.", + "groupsPermissionsHint": + "Determines if fine grained permissions are enabled for managing this role. Disabling will delete all current permissions that have been set up.", "permissionsScopeName": "Scope-name", "permissionsEnabled": "Permissions enabled", "permissionsDisable": "Disable permissions?", diff --git a/src/components/permission-tab/PermissionTab.tsx b/src/components/permission-tab/PermissionTab.tsx index 37bd1eb104..b1d4efd23b 100644 --- a/src/components/permission-tab/PermissionTab.tsx +++ b/src/components/permission-tab/PermissionTab.tsx @@ -31,7 +31,7 @@ import { useConfirmDialog } from "../confirm-dialog/ConfirmDialog"; import "./permissions-tab.css"; -type PermissionScreenType = "clients" | "users"; +type PermissionScreenType = "clients" | "users" | "groups"; type PermissionsTabProps = { id?: string; @@ -59,6 +59,8 @@ export const PermissionsTab = ({ id, type }: PermissionsTabProps) => { realm, enabled, }); + case "groups": + return adminClient.groups.updatePermission({ id: id! }, { enabled }); } }; @@ -77,6 +79,8 @@ export const PermissionsTab = ({ id, type }: PermissionsTabProps) => { return adminClient.realms.getUsersManagementPermissions({ realm, }); + case "groups": + return adminClient.groups.listPermissions({ id: id! }); } })(), ]), diff --git a/src/groups/GroupsSection.tsx b/src/groups/GroupsSection.tsx index ab076cefbe..324b0380c6 100644 --- a/src/groups/GroupsSection.tsx +++ b/src/groups/GroupsSection.tsx @@ -27,6 +27,7 @@ import { toGroups } from "./routes/Groups"; import { toGroupsSearch } from "./routes/GroupsSearch"; import { GroupRoleMapping } from "./GroupRoleMapping"; import helpUrls from "../help-urls"; +import { PermissionsTab } from "../components/permission-tab/PermissionTab"; import "./GroupsSection.css"; @@ -176,6 +177,13 @@ export default function GroupsSection() { > + {t("common:permissions")}} + > + + )} {subGroups.length === 0 && }