Skip to content

Commit

Permalink
fix: permissions tab should be only shown with the correct rights (ke…
Browse files Browse the repository at this point in the history
…ycloak#26034)

Signed-off-by: Peter Keuter <[email protected]>
  • Loading branch information
pkeuter authored Jan 16, 2024
1 parent 4958d25 commit 2cd23e2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion js/apps/admin-ui/src/user/UsersSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -60,7 +66,7 @@ export default function UsersSection() {
>
<UserDataTable />
</Tab>
{isFeatureEnabled(Feature.AdminFineGrainedAuthz) && (
{canViewPermissions && (
<Tab
id="permissions"
data-testid="permissionsTab"
Expand Down

0 comments on commit 2cd23e2

Please sign in to comment.