Only show default role effective roles (#20285)

fixes: #19982
This commit is contained in:
Erik Jan de Wit 2023-05-30 20:17:10 +02:00 committed by GitHub
parent 403632438a
commit d76c295c09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,6 +20,7 @@ import org.keycloak.models.ClientScopeModel;
import org.keycloak.models.GroupModel; import org.keycloak.models.GroupModel;
import org.keycloak.models.KeycloakSession; import org.keycloak.models.KeycloakSession;
import org.keycloak.models.RealmModel; import org.keycloak.models.RealmModel;
import org.keycloak.models.RoleModel;
import org.keycloak.models.UserModel; import org.keycloak.models.UserModel;
import org.keycloak.services.resources.admin.permissions.AdminPermissionEvaluator; import org.keycloak.services.resources.admin.permissions.AdminPermissionEvaluator;
@ -164,7 +165,8 @@ public class EffectiveRoleMappingResource extends RoleMappingResource {
)} )}
) )
public final List<ClientRole> listCompositeRealmRoleMappings() { public final List<ClientRole> listCompositeRealmRoleMappings() {
return mapping(o -> true).collect(Collectors.toList()); final RoleModel defaultRole = this.realm.getDefaultRole();
return mapping(o -> o.hasRole(defaultRole)).collect(Collectors.toList());
} }
} }