From b2999ada2de86c94b26f736319d7abe91372d676 Mon Sep 17 00:00:00 2001 From: Agnieszka Gancarczyk <4890675+agagancarczyk@users.noreply.github.com> Date: Tue, 20 Aug 2024 12:28:01 +0100 Subject: [PATCH] fix for default roles (#32243) Signed-off-by: Agnieszka Gancarczyk --- .../src/components/role-mapping/RoleMapping.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/js/apps/admin-ui/src/components/role-mapping/RoleMapping.tsx b/js/apps/admin-ui/src/components/role-mapping/RoleMapping.tsx index 36bec81da6..51ca15f18a 100644 --- a/js/apps/admin-ui/src/components/role-mapping/RoleMapping.tsx +++ b/js/apps/admin-ui/src/components/role-mapping/RoleMapping.tsx @@ -107,6 +107,7 @@ export const RoleMapping = ({ const loader = async () => { let effectiveRoles: Row[] = []; let effectiveClientRoles: Row[] = []; + if (!hide) { effectiveRoles = await getEffectiveRoles(adminClient, type, id); @@ -119,6 +120,13 @@ export const RoleMapping = ({ client: { clientId: e.client, id: e.clientId }, role: { id: e.id, name: e.role, description: e.description }, })); + + effectiveRoles = effectiveRoles.filter( + (role) => + !effectiveClientRoles.some( + (clientRole) => clientRole.role.id === role.role.id, + ), + ); } const roles = await getMapping(adminClient, type, id); @@ -135,7 +143,7 @@ export const RoleMapping = ({ return [ ...mapRoles( - [...realmRolesMapping, ...clientMapping], + [...clientMapping, ...realmRolesMapping], [...effectiveClientRoles, ...effectiveRoles], hide, ),