@Internal public class

CreateUserApplicationHelper

extends Object
implements UserApplicationHelper
java.lang.Object
   ↳ com.atlassian.jira.bc.user.CreateUserApplicationHelper

@Internal

This class is an internal implementation detail and will change without notice.

Clients that depend on @Internal classes and interfaces can not expect to be compatible with any version other than the version they were compiled against (even minor version and milestone releases may break binary compatibility with respect to @Internal elements).

Class Overview

Create User Application helper class.

Summary

Nested Classes
interface CreateUserApplicationHelper.ValidationFunction  
Public Constructors
CreateUserApplicationHelper(ApplicationRoleManager applicationRoleManager, I18nHelper i18nHelper, BaseUrl baseUrl, GlobalPermissionManager globalPermissionManager, LicenseCountService licenseCountService, FeatureManager featureManager, JiraLicenseManager jiraLicenseManager, GroupsToApplicationsSeatingHelper groupsToApplicationsSeatingHelper, UserManager userManager, CrowdService crowdService, GroupLabelsService groupLabels, AuthorisationManager authorisationManager)
Public Methods
boolean canUserLogin(ApplicationUser applicationUser)
Check if given user can login to JIRA.
@Nonnull List<UserApplicationHelper.ApplicationSelection> getApplicationsForSelection(Set<ApplicationKey> selectedApplicationKeys, Optional<Long> directoryId)
Return the ApplicationSelection calculated from the current state of JIRA.
@Nonnull List<UserApplicationHelper.ApplicationSelection> getApplicationsForUser(ApplicationUser user)
Return the ApplicationSelection calculated from the current state of JIRA for given (@code ApplicationUser).
Set<Group> getDefaultGroupsForNewUser(Set<ApplicationKey> applicationKeys)
Get the default groups of the specified applications that should be used during user creation.
@Nonnull List<GroupView> getUserGroups(ApplicationUser applicationUser)
Return the list of com.atlassian.jira.bc.user.GroupView connected with the given user.
@Nonnull Collection<String> validateApplicationKeys(Optional<Long> directoryId, Set<ApplicationKey> applicationKeys)
Validates if creating a user with given application access in given directory won't exceed license limit
@Nonnull Collection<String> validateApplicationKeys(ApplicationUser user, Set<ApplicationKey> applicationKeys)
Validates if adding a user with given application access to given applications won't exceed license limit
@Nonnull Collection<String> validateApplicationKeys(Optional<Long> directoryId, Set<ApplicationKey> applicationKeys, EnumSet<UserApplicationHelper.ValidationScope> validationScope)
Validates if creating a user with given application access in given directory won't cause issues defined in UserApplicationHelper.ValidationScope
@Nonnull 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
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.bc.user.UserApplicationHelper

Public Constructors

public CreateUserApplicationHelper (ApplicationRoleManager applicationRoleManager, I18nHelper i18nHelper, BaseUrl baseUrl, GlobalPermissionManager globalPermissionManager, LicenseCountService licenseCountService, FeatureManager featureManager, JiraLicenseManager jiraLicenseManager, GroupsToApplicationsSeatingHelper groupsToApplicationsSeatingHelper, UserManager userManager, CrowdService crowdService, GroupLabelsService groupLabels, AuthorisationManager authorisationManager)

Public Methods

public boolean canUserLogin (ApplicationUser applicationUser)

Check if given user can login to JIRA. Return true if user has any role or has admin/sysadmin privileges

Parameters
applicationUser given user
Returns
  • true if user has any role or is an admin

@Nonnull public List<UserApplicationHelper.ApplicationSelection> getApplicationsForSelection (Set<ApplicationKey> selectedApplicationKeys, Optional<Long> directoryId)

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).

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.

@Nonnull public List<UserApplicationHelper.ApplicationSelection> getApplicationsForUser (ApplicationUser user)

Return the ApplicationSelection calculated from the current state of JIRA for given (@code ApplicationUser).

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.

public Set<Group> getDefaultGroupsForNewUser (Set<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. This is ignored when in dark ages mode (pre renaissance) ApplicationRoleManager#rolesEnabled().
Returns
  • the groups that the new user can be safely added to.

@Nonnull public List<GroupView> getUserGroups (ApplicationUser applicationUser)

Return the list of com.atlassian.jira.bc.user.GroupView connected with the given user. It respects nested groups.

Parameters
applicationUser the user
Returns
  • an immutable list of com.atlassian.jira.bc.user.GroupView

@Nonnull public Collection<String> validateApplicationKeys (Optional<Long> directoryId, Set<ApplicationKey> applicationKeys)

Validates if creating a user with given application access in given directory won't exceed license limit

Parameters
directoryId the Directory ID, or empty() if default directory should be checked
applicationKeys validated application keys
Returns
  • a collection of errors

@Nonnull public Collection<String> validateApplicationKeys (ApplicationUser user, Set<ApplicationKey> applicationKeys)

Validates if adding a user with given application access to given applications won't exceed license limit

Parameters
user validated user
applicationKeys validated application keys
Returns
  • a collection of errors

@Nonnull public Collection<String> validateApplicationKeys (Optional<Long> directoryId, Set<ApplicationKey> applicationKeys, EnumSet<UserApplicationHelper.ValidationScope> validationScope)

Validates if creating a user with given application access in given directory won't cause issues defined in UserApplicationHelper.ValidationScope

Parameters
directoryId the Directory ID, or empty() if default directory should be checked
applicationKeys validated application keys
validationScope required validation scope
Returns
  • a collection of errors

@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

Parameters
directoryId the Directory ID, or empty() if default directory should be checked
Returns
  • a collection of errors