3ccfe521 by Adam Heath

Map UserAccount.disabled to User.setEnabled, instead of only basing it

on when a newPassword is available.
1 parent d8351e91
...@@ -165,7 +165,7 @@ Map<String, Object> syncUserAccount() { ...@@ -165,7 +165,7 @@ Map<String, Object> syncUserAccount() {
165 } 165 }
166 String keycloakUserId = userAccount.externalUserId 166 String keycloakUserId = userAccount.externalUserId
167 logger.info("Would update: keycloak(${keycloakUserId})") 167 logger.info("Would update: keycloak(${keycloakUserId})")
168 updateUser(keycloakUserId, userId, newPassword != null) 168 updateUser(keycloakUserId, userId)
169 169
170 if (newPassword != null) { 170 if (newPassword != null) {
171 UserResource userResource = usersResource.get(keycloakUserId) 171 UserResource userResource = usersResource.get(keycloakUserId)
...@@ -397,7 +397,7 @@ Map<String, RoleRepresentation> getClientRoles(RealmResource realm, ClientResour ...@@ -397,7 +397,7 @@ Map<String, RoleRepresentation> getClientRoles(RealmResource realm, ClientResour
397 // return getKeycloakGroup(realm, "moqui:userGroup:${userGroup.userGroupId}", sync) 397 // return getKeycloakGroup(realm, "moqui:userGroup:${userGroup.userGroupId}", sync)
398 //} 398 //}
399 399
400 void updateUser(String keycloakUserId, String userId, boolean enabled) { 400 void updateUser(String keycloakUserId, String userId) {
401 401
402 RealmResource realmResource = getKeycloakRealm() 402 RealmResource realmResource = getKeycloakRealm()
403 String keycloakClientId = getKeycloakClientId() 403 String keycloakClientId = getKeycloakClientId()
...@@ -455,9 +455,7 @@ void updateUser(String keycloakUserId, String userId, boolean enabled) { ...@@ -455,9 +455,7 @@ void updateUser(String keycloakUserId, String userId, boolean enabled) {
455 RoleScopeResource clientRoleScopeResource = roleMappingResource.clientLevel(keycloakClientId) 455 RoleScopeResource clientRoleScopeResource = roleMappingResource.clientLevel(keycloakClientId)
456 clientRoleScopeResource.remove(toRemove) 456 clientRoleScopeResource.remove(toRemove)
457 clientRoleScopeResource.add(toAdd) 457 clientRoleScopeResource.add(toAdd)
458 if (enabled) { 458 userRep.setEnabled("N".equals(userAccount.disabled))
459 userRep.setEnabled(true)
460 }
461 459
462 userResource.update(userRep) 460 userResource.update(userRep)
463 Map<String, Object> foo = userResource.impersonate() 461 Map<String, Object> foo = userResource.impersonate()
......