Class UserService.CreateUserRequest

java.lang.Object
com.atlassian.jira.bc.user.UserService.CreateUserRequest
Enclosing interface:
UserService

@PublicApi public static final class UserService.CreateUserRequest extends Object
This request contains all the instructions and user details that should be used during user validation and user creation.
  • Method Details

    • withUserDetails

      public static UserService.CreateUserRequest withUserDetails(@Nullable ApplicationUser loggedInUser, String username, @Nullable String password, String emailAddress, String displayName)
      Create a new user creation request as the provided user for the specified user details. This request indicates that the new users should be created in the default user directory and have access to the default applications. A Notification would be sent after user creation.
      Parameters:
      loggedInUser - application user performing the create. If null the user creation is being performed during setup or signup.
      username - The username of the new user. Needs to be lowercase and unique. Required.
      password - The password for the new user. If empty a random password will be generated.
      emailAddress - The email address for the new user. Required.
      displayName - The display name for the new user. Required.
    • confirmPassword

      public UserService.CreateUserRequest confirmPassword(String confirmPassword)
      Confirm that the provided password matches the confirm password provided.
      Parameters:
      confirmPassword - the confirm password that should match the provided password.
    • withNoApplicationAccess

      public UserService.CreateUserRequest withNoApplicationAccess()
      Indicate that no application access is required for the new user.
    • withApplicationAccess

      public UserService.CreateUserRequest withApplicationAccess(@Nonnull Set<com.atlassian.application.api.ApplicationKey> applicationKeys)
      Specify the applications that this user required access to.
      Parameters:
      applicationKeys - applications that user should be granted access to, an empty Set indicates that the user does not require access to any applications.
      See Also:
    • sendNotification

      public UserService.CreateUserRequest sendNotification(boolean sendNotification)
      Specify whether a notification should be sent when the new user has successfully been created.
      Parameters:
      sendNotification - true if notification should be sent after a new user has successfully been created. false if no notification should be sent.
    • sendUserSignupEvent

      public UserService.CreateUserRequest sendUserSignupEvent()
      Specify that a user signup event should be sent after user creation. Typically when the new user is being created during signup.
    • passwordRequired

      public UserService.CreateUserRequest passwordRequired()
      Specify that the user password is required.
    • performPermissionCheck

      public UserService.CreateUserRequest performPermissionCheck(boolean performPermissionCheck)
      Indicate that the permission check should not be performed on the logged in user to determine whether the logged in user has permission to create the new user.
      Parameters:
      performPermissionCheck - true if the permission check should be performed else false to skip the permission check.
    • inDirectory

      public UserService.CreateUserRequest inDirectory(Long directoryId)
      Specify what user directory should be used for new user.
      Parameters:
      directoryId - The directory which the new user is intended to be created in. null indicates that the default directory should be used.
    • skipValidation

      @Internal public UserService.CreateUserRequest skipValidation()
      Specify that all validations should be skipped. This should only be used when it does not matter that user gets created or added.
    • withEventUserEvent

      @Internal public UserService.CreateUserRequest withEventUserEvent(int userEventType)
      Deprecated.
      Since v7.0.
      This method has been made public only to allow temporary backwards compatibility and will be removed in 7.0.

      Set the event type to be dispatch after user creation. This has been added for compatibility reasons please avoid using this.

      Parameters:
      userEventType - the event type that should be sent after user has been created.
      See Also:
    • requirePassword

      public boolean requirePassword()
      Determine whether the user password is required.
      Returns:
      true is user password is required else faslse.
    • getUsername

      public String getUsername()
      Return the user name that is used to identify the new user.
      Returns:
      the user name that is used to identify the new user.
    • getPassword

      public String getPassword()
      Return the password for the new user.
      Returns:
      the password for the new user.
    • getDisplayName

      public String getDisplayName()
      Return the display name (also known as full name) for the new user.
      Returns:
      the display name (also known as full name) for the new user.
    • getEmailAddress

      public String getEmailAddress()
      Return the email address for the new user.
      Returns:
      the email address for the new user.
    • defaultDirectory

      public boolean defaultDirectory()
      Determine whether the default user directory should be used for the new user.
    • getDirectoryId

      public Long getDirectoryId()
      Return the directory id (representing the user directory), that the new user should be created in. This is typically left unset null indicating default.
      Returns:
      the directory id (representing the user directory), that the new user should be created in.
    • shouldConfirmPassword

      public boolean shouldConfirmPassword()
      Determine whether the confirmation password should be validation or whether the confirmation password has been set.
      Returns:
      true if the confirmPassword(String) should be compared against the getPassword().
    • getConfirmPassword

      public String getConfirmPassword()
      Return the confirmation password that should be compared against the getPassword(). This is typically set by confirmPassword(String) to indicate that the confirm password should be validated against the getPassword().
      Returns:
      the confirmation password that should be compared against the getPassword().
    • requireDefaultApplicationAccess

      public boolean requireDefaultApplicationAccess()
      Determine whether the new user requires default application access. Default application access is the configuration that indicates what applications a new user should be added to.
      Returns:
      true if the new user should be granted access to the default applications else false.
    • getApplicationKeys

      public Set<com.atlassian.application.api.ApplicationKey> getApplicationKeys()
      Return the application keys that are used to specify what application access the new user requires.
      Returns:
      the application keys that are used to specify what application access the new user requires.
      See Also:
    • shouldSendNotification

      public boolean shouldSendNotification()
      Determine whether a notification should be sent after user creation.
      Returns:
      true if a notification should be sent after user creation. false if a notification should not be sent after user creation.
      See Also:
    • shouldSendUserSignupEvent

      public boolean shouldSendUserSignupEvent()
      Determine whether a signup event should be sent after user has been created. This is typically true when the user is being created via signup.
      Returns:
      true if a signup event should be sent after user has been created.
    • getLoggedInUser

      public ApplicationUser getLoggedInUser()
      Return the logged in user that would be performing the user creation.
      Returns:
      the application user performing the user creation.
    • shouldPerformPermissionCheck

      public boolean shouldPerformPermissionCheck()