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 ...@@ -227,8 +227,8 @@ void updateUser(RealmResource realm, String keycloakClientId, String keycloakUse
227 227
228 List<RoleRepresentation> toRemove = [] 228 List<RoleRepresentation> toRemove = []
229 RoleMappingResource roleMappingResource = userResource.roles() 229 RoleMappingResource roleMappingResource = userResource.roles()
230 ClientMappingsRepresentation clientMappingsRespresentation = roleMappingResource.getAll().getClientMappings()[keycloakClientId] 230 ClientMappingsRepresentation clientMappingsRespresentation = roleMappingResource.getAll().getClientMappings()?[keycloakClientId]
231 for (RoleRepresentation existingRoleRep: clientMappingsRespresentation.getMappings()) { 231 for (RoleRepresentation existingRoleRep: clientMappingsRespresentation?.getMappings()) {
232 if (!wantedClientRoles.remove(existingRoleRep.getName())) { 232 if (!wantedClientRoles.remove(existingRoleRep.getName())) {
233 toRemove.add(existingRoleRep) 233 toRemove.add(existingRoleRep)
234 } 234 }
......