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:
parent
4958d25e46
commit
2cd23e29e5
1 changed files with 7 additions and 1 deletions
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue