mirror of
https://github.com/keycloak/keycloak.git
synced 2026-01-09 23:12:06 -03:30
Fix for Network error attempting to view default realm roles without permissions (#31902)
* fix for issue #29211 Signed-off-by: Himanshi Gupta <higupta@redhat.com> * fix for issue #29211 Signed-off-by: Himanshi Gupta <higupta@redhat.com> --------- Signed-off-by: Himanshi Gupta <higupta@redhat.com> (cherry picked from commit 7cf9946040ba3334fecef144170520ea08e25c3e)
This commit is contained in:
parent
e0d37bd18d
commit
04a3b22603
@ -12,8 +12,8 @@ import { useAlerts } from "../alert/Alerts";
|
||||
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;
|
||||
@ -29,13 +29,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"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user