NPE in create user

This commit is contained in:
Bill Burke 2014-03-13 10:56:09 -04:00
parent 7fff2588b2
commit 08769a2daa

View file

@ -10,13 +10,15 @@ import org.keycloak.models.RealmModel;
import org.keycloak.models.RoleModel; import org.keycloak.models.RoleModel;
import org.keycloak.models.UserCredentialModel; import org.keycloak.models.UserCredentialModel;
import org.keycloak.models.UserModel; import org.keycloak.models.UserModel;
import org.keycloak.representations.adapters.action.SessionStats;
import org.keycloak.representations.adapters.action.UserStats; import org.keycloak.representations.adapters.action.UserStats;
import org.keycloak.representations.idm.*; import org.keycloak.representations.idm.ApplicationMappingsRepresentation;
import org.keycloak.representations.idm.CredentialRepresentation;
import org.keycloak.representations.idm.MappingsRepresentation;
import org.keycloak.representations.idm.RoleRepresentation;
import org.keycloak.representations.idm.UserRepresentation;
import org.keycloak.services.email.EmailException; import org.keycloak.services.email.EmailException;
import org.keycloak.services.email.EmailSender; import org.keycloak.services.email.EmailSender;
import org.keycloak.services.managers.AccessCodeEntry; import org.keycloak.services.managers.AccessCodeEntry;
import org.keycloak.services.managers.Auth;
import org.keycloak.services.managers.ModelToRepresentation; import org.keycloak.services.managers.ModelToRepresentation;
import org.keycloak.services.managers.RealmManager; import org.keycloak.services.managers.RealmManager;
import org.keycloak.services.managers.ResourceAdminManager; import org.keycloak.services.managers.ResourceAdminManager;
@ -119,6 +121,7 @@ public class UsersResource {
List<String> reqActions = rep.getRequiredActions(); List<String> reqActions = rep.getRequiredActions();
if (reqActions != null) {
for (UserModel.RequiredAction ra : UserModel.RequiredAction.values()) { for (UserModel.RequiredAction ra : UserModel.RequiredAction.values()) {
if (reqActions.contains(ra.name())) { if (reqActions.contains(ra.name())) {
user.addRequiredAction(ra); user.addRequiredAction(ra);
@ -126,6 +129,7 @@ public class UsersResource {
user.removeRequiredAction(ra); user.removeRequiredAction(ra);
} }
} }
}
if (rep.getAttributes() != null) { if (rep.getAttributes() != null) {
for (Map.Entry<String, String> attr : rep.getAttributes().entrySet()) { for (Map.Entry<String, String> attr : rep.getAttributes().entrySet()) {
@ -182,7 +186,6 @@ public class UsersResource {
} }
@Path("{username}") @Path("{username}")
@DELETE @DELETE
@NoCache @NoCache