Class CreateUserApplicationHelper

java.lang.Object
com.atlassian.jira.bc.user.CreateUserApplicationHelper
All Implemented Interfaces:
UserApplicationHelper

@Internal public class CreateUserApplicationHelper extends Object implements UserApplicationHelper
Create User Application helper class.
Since:
v7.0
  • Constructor Details

  • Method Details

    • getApplicationsForSelection

      @Nonnull public List<UserApplicationHelper.ApplicationSelection> getApplicationsForSelection(@Nonnull Set<com.atlassian.application.api.ApplicationKey> selectedApplicationKeys, @Nonnull Optional<Long> directoryId)
      Description copied from interface: UserApplicationHelper
      Return the ApplicationSelection calculated from the current state of JIRA. The passed applications are marked as selected (if they exist). The returned list will be ordered based on the Application name except that JIRA Core will be returned last (if it exists).
      Specified by:
      getApplicationsForSelection in interface UserApplicationHelper
      Parameters:
      selectedApplicationKeys - the set of application keys to mark as selected.
      directoryId - optional directoryId to use for application selection
      Returns:
      an immutable list of ApplicationSelection ordered by their name except that JIRA Core is always last.
    • getApplicationsForUser

      @Nonnull public List<UserApplicationHelper.ApplicationSelection> getApplicationsForUser(@Nonnull ApplicationUser user)
      Description copied from interface: UserApplicationHelper
      Return the ApplicationSelection calculated from the current state of JIRA for given (@code ApplicationUser).
      Specified by:
      getApplicationsForUser in interface UserApplicationHelper
      Parameters:
      user - subject application user to get applications for.
      Returns:
      an immutable list of ApplicationSelection ordered by their name except that JIRA Core is always last.
    • getUserGroups

      @Nonnull public List<GroupView> getUserGroups(@Nonnull ApplicationUser applicationUser)
      Description copied from interface: UserApplicationHelper
      Return the list of com.atlassian.jira.bc.user.GroupView connected with the given user. It respects nested groups.
      Specified by:
      getUserGroups in interface UserApplicationHelper
      Parameters:
      applicationUser - the user
      Returns:
      an immutable list of com.atlassian.jira.bc.user.GroupView
    • validateDefaultApplications

      @Nonnull public Collection<String> validateDefaultApplications(EnumSet<UserApplicationHelper.ValidationScope> validationScope, Optional<Long> directoryId)
      Validates if creating a user with default application access in given directory won't exceed license limit
      Specified by:
      validateDefaultApplications in interface UserApplicationHelper
      Parameters:
      directoryId - the Directory ID, or Optional.empty() if default directory should be checked
      Returns:
      a collection of errors
    • validateApplicationKeys

      @Nonnull public Collection<String> validateApplicationKeys(@Nonnull Optional<Long> directoryId, @Nonnull Set<com.atlassian.application.api.ApplicationKey> applicationKeys)
      Validates if creating a user with given application access in given directory won't exceed license limit
      Specified by:
      validateApplicationKeys in interface UserApplicationHelper
      Parameters:
      directoryId - the Directory ID, or Optional.empty() if default directory should be checked
      applicationKeys - validated application keys
      Returns:
      a collection of errors
    • validateApplicationKeys

      @Nonnull public Collection<String> validateApplicationKeys(@Nonnull ApplicationUser user, @Nonnull Set<com.atlassian.application.api.ApplicationKey> applicationKeys)
      Description copied from interface: UserApplicationHelper
      Validates if adding a user with given application access to given applications won't exceed license limit
      Specified by:
      validateApplicationKeys in interface UserApplicationHelper
      Parameters:
      user - validated user
      applicationKeys - validated application keys
      Returns:
      a collection of errors
    • validateApplicationKeys

      @Nonnull public Collection<String> validateApplicationKeys(@Nonnull Optional<Long> directoryId, @Nonnull Set<com.atlassian.application.api.ApplicationKey> applicationKeys, @Nonnull EnumSet<UserApplicationHelper.ValidationScope> validationScope)
      Description copied from interface: UserApplicationHelper
      Validates if creating a user with given application access in given directory won't cause issues defined in UserApplicationHelper.ValidationScope
      Specified by:
      validateApplicationKeys in interface UserApplicationHelper
      Parameters:
      directoryId - the Directory ID, or Optional.empty() if default directory should be checked
      applicationKeys - validated application keys
      validationScope - required validation scope
      Returns:
      a collection of errors
    • canUserLogin

      public boolean canUserLogin(@Nullable ApplicationUser applicationUser)
      Description copied from interface: UserApplicationHelper
      Check if given user can login to JIRA. Return true if user has any role or has admin/sysadmin privileges
      Specified by:
      canUserLogin in interface UserApplicationHelper
      Parameters:
      applicationUser - given user
      Returns:
      true if user has any role or is an admin
    • getDefaultGroupsForNewUser

      public Set<com.atlassian.crowd.embedded.api.Group> getDefaultGroupsForNewUser(Set<com.atlassian.application.api.ApplicationKey> applicationKeys)
      Get the default groups of the specified applications that should be used during user creation. The default groups of an application is only returned if the application license permits that a new user can be added to the application.

      This method is dark ages compatible (pre renaissance) in that if would return the 'JIRA Users' global permissions groups if the license permits a new user.

      Parameters:
      applicationKeys - the keys that indicate what application access a user requires.
      Returns:
      the groups that the new user can be safely added to.