Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions js/apps/admin-ui/src/components/roles-list/RolesList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { useAlerts } from "@keycloak/keycloak-ui-shared";
import { useConfirmDialog } from "../confirm-dialog/ConfirmDialog";
import { ListEmptyState } from "../list-empty-state/ListEmptyState";
import { Action, KeycloakDataTable } from "../table-toolbar/KeycloakDataTable";

import "./RolesList.css";
import { useAccess } from "../../context/access/Access";

type RoleDetailLinkProps = RoleRepresentation & {
defaultRoleName?: string;
Expand All @@ -30,13 +30,21 @@ const RoleDetailLink = ({
}: RoleDetailLinkProps) => {
const { t } = useTranslation(messageBundle);
const { realm } = useRealm();
const { hasAccess, hasSomeAccess } = useAccess();
const canViewUserRegistration =
hasAccess("view-realm") && hasSomeAccess("view-clients", "manage-clients");

return role.name !== defaultRoleName ? (
<Link to={toDetail(role.id!)}>{role.name}</Link>
) : (
<>
<Link to={toRealmSettings({ realm, tab: "user-registration" })}>
{role.name}{" "}
</Link>
{canViewUserRegistration ? (
<Link to={toRealmSettings({ realm, tab: "user-registration" })}>
{role.name}
</Link>
) : (
<span>{role.name}</span>
)}
<HelpItem
helpText={t(`${messageBundle}:defaultRole`)}
fieldLabelId="defaultRole"
Expand Down