fix: permissions tab should be only shown with the correct rights (#26034)

Signed-off-by: Peter Keuter <github@peterkeuter.nl>
This commit is contained in:
Peter Keuter 2024-01-16 14:26:58 +01:00 committed by GitHub
parent 4958d25e46
commit 2cd23e29e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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() {
>
<UserDataTable />
</Tab>
{isFeatureEnabled(Feature.AdminFineGrainedAuthz) && (
{canViewPermissions && (
<Tab
id="permissions"
data-testid="permissionsTab"