024ec6a4 by Adam Heath

Deal with the case when there are no existing client role mappings for

the user(ie, it's a first time for an update).
1 parent 37f2f2df
......@@ -227,8 +227,8 @@ void updateUser(RealmResource realm, String keycloakClientId, String keycloakUse
List<RoleRepresentation> toRemove = []
RoleMappingResource roleMappingResource = userResource.roles()
ClientMappingsRepresentation clientMappingsRespresentation = roleMappingResource.getAll().getClientMappings()[keycloakClientId]
for (RoleRepresentation existingRoleRep: clientMappingsRespresentation.getMappings()) {
ClientMappingsRepresentation clientMappingsRespresentation = roleMappingResource.getAll().getClientMappings()?[keycloakClientId]
for (RoleRepresentation existingRoleRep: clientMappingsRespresentation?.getMappings()) {
if (!wantedClientRoles.remove(existingRoleRep.getName())) {
toRemove.add(existingRoleRep)
}
......