From 2cd23e29e5532527c63ad1c17e5bb50dec52f009 Mon Sep 17 00:00:00 2001 From: Peter Keuter Date: Tue, 16 Jan 2024 14:26:58 +0100 Subject: [PATCH] fix: permissions tab should be only shown with the correct rights (#26034) Signed-off-by: Peter Keuter --- js/apps/admin-ui/src/user/UsersSection.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/js/apps/admin-ui/src/user/UsersSection.tsx b/js/apps/admin-ui/src/user/UsersSection.tsx index e2bc5ca769..b3f67b0750 100644 --- a/js/apps/admin-ui/src/user/UsersSection.tsx +++ b/js/apps/admin-ui/src/user/UsersSection.tsx @@ -13,12 +13,18 @@ import { } from "../components/routable-tabs/RoutableTabs"; import useIsFeatureEnabled, { Feature } from "../utils/useIsFeatureEnabled"; import "./user-section.css"; +import { useAccess } from "../context/access/Access"; export default function UsersSection() { const { t } = useTranslation(); const { realm: realmName } = useRealm(); + const { hasAccess } = useAccess(); const isFeatureEnabled = useIsFeatureEnabled(); + const canViewPermissions = + isFeatureEnabled(Feature.AdminFineGrainedAuthz) && + hasAccess("manage-authorization", "manage-users", "manage-clients"); + const useTab = (tab: UserTab) => useRoutableTab( toUsers({ @@ -60,7 +66,7 @@ export default function UsersSection() { > - {isFeatureEnabled(Feature.AdminFineGrainedAuthz) && ( + {canViewPermissions && (