mirror of
https://github.com/keycloak/keycloak.git
synced 2025-12-19 05:20:21 -06:00
Fixing tests
Signed-off-by: Alexander Schwartz <alexander.schwartz@ibm.com>
This commit is contained in:
committed by
Pedro Igor
parent
76f2e85b1e
commit
5995815bcc
@@ -62,11 +62,13 @@ public abstract class AbstractAttributeToRoleMapper extends AbstractIdentityProv
|
|||||||
if (!context.hasMapperGrantedRole(roleName)) {
|
if (!context.hasMapperGrantedRole(roleName)) {
|
||||||
if (this.applies(mapperModel, context)) {
|
if (this.applies(mapperModel, context)) {
|
||||||
context.addMapperGrantedRole(roleName);
|
context.addMapperGrantedRole(roleName);
|
||||||
if (user.getRealmRoleMappingsStream().noneMatch(r -> r.equals(role))) {
|
if ((!role.isClientRole() && user.getRealmRoleMappingsStream().noneMatch(r -> r.equals(role)))
|
||||||
|
|| (role.isClientRole() && user.getClientRoleMappingsStream(session.clients().getClientById(realm, role.getContainerId())).noneMatch(r -> r.equals(role)))) {
|
||||||
user.grantRole(role);
|
user.grantRole(role);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (user.getRealmRoleMappingsStream().anyMatch(r -> r.equals(role))) {
|
if ((!role.isClientRole() && user.getRealmRoleMappingsStream().anyMatch(r -> r.equals(role)))
|
||||||
|
|| (role.isClientRole() && user.getClientRoleMappingsStream(session.clients().getClientById(realm, role.getContainerId())).anyMatch(r -> r.equals(role)))) {
|
||||||
user.deleteRoleMapping(role);
|
user.deleteRoleMapping(role);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user