fix for default roles (#32243)

Signed-off-by: Agnieszka Gancarczyk <agagancarczyk@gmail.com>
This commit is contained in:
Agnieszka Gancarczyk 2024-08-20 12:28:01 +01:00 committed by GitHub
parent aee9390812
commit b2999ada2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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,
),