From 04a3b22603e7bd91195cd62f4c8585920a651dca Mon Sep 17 00:00:00 2001 From: himanshi1099 <143601879+himanshi1099@users.noreply.github.com> Date: Mon, 5 Aug 2024 22:08:10 +0530 Subject: [PATCH] Fix for Network error attempting to view default realm roles without permissions (#31902) * fix for issue #29211 Signed-off-by: Himanshi Gupta * fix for issue #29211 Signed-off-by: Himanshi Gupta --------- Signed-off-by: Himanshi Gupta (cherry picked from commit 7cf9946040ba3334fecef144170520ea08e25c3e) --- .../src/components/roles-list/RolesList.tsx | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/js/apps/admin-ui/src/components/roles-list/RolesList.tsx b/js/apps/admin-ui/src/components/roles-list/RolesList.tsx index 16064e899d2..42aa68fec68 100644 --- a/js/apps/admin-ui/src/components/roles-list/RolesList.tsx +++ b/js/apps/admin-ui/src/components/roles-list/RolesList.tsx @@ -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 ? ( {role.name} ) : ( <> - - {role.name}{" "} - + {canViewUserRegistration ? ( + + {role.name} + + ) : ( + {role.name} + )}