From d76c295c09f99877cc77c44c31b9dc9c8dd7b650 Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Tue, 30 May 2023 20:17:10 +0200 Subject: [PATCH] Only show default role effective roles (#20285) fixes: #19982 --- .../keycloak/admin/ui/rest/EffectiveRoleMappingResource.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rest/admin-ui-ext/src/main/java/org/keycloak/admin/ui/rest/EffectiveRoleMappingResource.java b/rest/admin-ui-ext/src/main/java/org/keycloak/admin/ui/rest/EffectiveRoleMappingResource.java index 118c06f3e6..287dd4ad31 100644 --- a/rest/admin-ui-ext/src/main/java/org/keycloak/admin/ui/rest/EffectiveRoleMappingResource.java +++ b/rest/admin-ui-ext/src/main/java/org/keycloak/admin/ui/rest/EffectiveRoleMappingResource.java @@ -20,6 +20,7 @@ import org.keycloak.models.ClientScopeModel; import org.keycloak.models.GroupModel; import org.keycloak.models.KeycloakSession; import org.keycloak.models.RealmModel; +import org.keycloak.models.RoleModel; import org.keycloak.models.UserModel; import org.keycloak.services.resources.admin.permissions.AdminPermissionEvaluator; @@ -164,7 +165,8 @@ public class EffectiveRoleMappingResource extends RoleMappingResource { )} ) public final List listCompositeRealmRoleMappings() { - return mapping(o -> true).collect(Collectors.toList()); + final RoleModel defaultRole = this.realm.getDefaultRole(); + return mapping(o -> o.hasRole(defaultRole)).collect(Collectors.toList()); } }