protected void doValidation() { final CreateUserRequest createUserRequest = CreateUserRequest .withUserDetails(getLoggedInUser(), getUsername(), getPassword(), getEmail(), getFullname()) .inDirectory(getDirectoryId()) .withApplicationAccess(getSelectedApplicationKeys()) .sendNotification(sendEmail); result = userService.validateCreateUser(createUserRequest); if (!result.isValid()) { addErrorCollection(result.getErrorCollection()); } passwordErrors = result.getPasswordErrors().stream().map(er -> er.getSnippet()).collect(Collectors.toList()); }
log.warn("Could not create external user " + externalUser + ": " + validation.getErrorCollection()); return false;
throw new BadRequestWebException(ErrorCollection.of(validationResult.getErrorCollection()));
addErrorCollection(result.getErrorCollection());
public RemoteUser createUser(User remoteUser, String username, String password, String fullName, String email) throws RemoteValidationException, RemotePermissionException { if (username != null) { username = username.trim(); } final com.atlassian.jira.bc.user.UserService.CreateUserValidationResult result = userService.validateCreateUserForAdminPasswordRequired(remoteUser, username, password, password, email, fullName); if (!result.isValid()) { throw new RemoteValidationException("Error creating user", result.getErrorCollection()); } try { User user = userService.createUserWithNotification(result); return remoteEntityFactory.createUser(user); } catch (PermissionException e) { throw new RemoteValidationException("cannot create user details, cause: " + e.getMessage(), e); } catch (CreateException e) { throw new RemoteValidationException("cannot create user details, cause: " + e.getMessage(), e); } }
@Override protected void doValidation() { // return with no error messages, doExecute() will return the already setup view if (setupAlready()) { return; } final String adminUsername = getUsername() != null ? getUsername().trim() : getUsername(); final CreateUserRequest createUserRequest = CreateUserRequest .withUserDetails(getLoggedInUser(), adminUsername, getPassword(), getEmail(), getFullname()) .confirmPassword(getConfirm()) .passwordRequired() .performPermissionCheck(false) .sendNotification(false); result = userService.validateCreateUser(createUserRequest); if (!result.isValid()) { addErrorCollection(result.getErrorCollection()); } }