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";
|
} from "../components/routable-tabs/RoutableTabs";
|
||||||
import useIsFeatureEnabled, { Feature } from "../utils/useIsFeatureEnabled";
|
import useIsFeatureEnabled, { Feature } from "../utils/useIsFeatureEnabled";
|
||||||
import "./user-section.css";
|
import "./user-section.css";
|
||||||
|
import { useAccess } from "../context/access/Access";
|
||||||
|
|
||||||
export default function UsersSection() {
|
export default function UsersSection() {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { realm: realmName } = useRealm();
|
const { realm: realmName } = useRealm();
|
||||||
|
const { hasAccess } = useAccess();
|
||||||
const isFeatureEnabled = useIsFeatureEnabled();
|
const isFeatureEnabled = useIsFeatureEnabled();
|
||||||
|
|
||||||
|
const canViewPermissions =
|
||||||
|
isFeatureEnabled(Feature.AdminFineGrainedAuthz) &&
|
||||||
|
hasAccess("manage-authorization", "manage-users", "manage-clients");
|
||||||
|
|
||||||
const useTab = (tab: UserTab) =>
|
const useTab = (tab: UserTab) =>
|
||||||
useRoutableTab(
|
useRoutableTab(
|
||||||
toUsers({
|
toUsers({
|
||||||
|
@ -60,7 +66,7 @@ export default function UsersSection() {
|
||||||
>
|
>
|
||||||
<UserDataTable />
|
<UserDataTable />
|
||||||
</Tab>
|
</Tab>
|
||||||
{isFeatureEnabled(Feature.AdminFineGrainedAuthz) && (
|
{canViewPermissions && (
|
||||||
<Tab
|
<Tab
|
||||||
id="permissions"
|
id="permissions"
|
||||||
data-testid="permissionsTab"
|
data-testid="permissionsTab"
|
||||||
|
|
Loading…
Reference in a new issue