Package com.atlassian.jira.bc.user
Class CreateUserApplicationHelper
java.lang.Object
com.atlassian.jira.bc.user.CreateUserApplicationHelper
- All Implemented Interfaces:
UserApplicationHelper
Create User Application helper class.
- Since:
- v7.0
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface com.atlassian.jira.bc.user.UserApplicationHelper
UserApplicationHelper.ApplicationSelection, UserApplicationHelper.ValidationScope -
Constructor Summary
ConstructorsConstructorDescriptionCreateUserApplicationHelper(ApplicationRoleManager applicationRoleManager, I18nHelper i18nHelper, BaseUrl baseUrl, GlobalPermissionManager globalPermissionManager, LicenseCountService licenseCountService, FeatureManager featureManager, JiraLicenseManager jiraLicenseManager, GroupsToApplicationsSeatingHelper groupsToApplicationsSeatingHelper, UserManager userManager, com.atlassian.crowd.embedded.api.CrowdService crowdService, GroupLabelsService groupLabels, AuthorisationManager authorisationManager) -
Method Summary
Modifier and TypeMethodDescriptionbooleancanUserLogin(ApplicationUser applicationUser) Check if given user can login to JIRA.getApplicationsForSelection(Set<com.atlassian.application.api.ApplicationKey> selectedApplicationKeys, Optional<Long> directoryId) Return theApplicationSelectioncalculated from the current state of JIRA.Return theApplicationSelectioncalculated from the current state of JIRA for given (@code ApplicationUser).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.getUserGroups(ApplicationUser applicationUser) Return the list ofcom.atlassian.jira.bc.user.GroupViewconnected with the given user.validateApplicationKeys(ApplicationUser user, Set<com.atlassian.application.api.ApplicationKey> applicationKeys) Validates if adding a user with given application access to given applications won't exceed license limitvalidateApplicationKeys(Optional<Long> directoryId, Set<com.atlassian.application.api.ApplicationKey> applicationKeys) Validates if creating a user with given application access in given directory won't exceed license limitvalidateApplicationKeys(Optional<Long> directoryId, Set<com.atlassian.application.api.ApplicationKey> applicationKeys, EnumSet<UserApplicationHelper.ValidationScope> validationScope) Validates if creating a user with given application access in given directory won't cause issues defined inUserApplicationHelper.ValidationScopevalidateDefaultApplications(EnumSet<UserApplicationHelper.ValidationScope> validationScope, Optional<Long> directoryId) Validates if creating a user with default application access in given directory won't exceed license limit
-
Constructor Details
-
CreateUserApplicationHelper
public CreateUserApplicationHelper(ApplicationRoleManager applicationRoleManager, I18nHelper i18nHelper, BaseUrl baseUrl, GlobalPermissionManager globalPermissionManager, LicenseCountService licenseCountService, FeatureManager featureManager, JiraLicenseManager jiraLicenseManager, GroupsToApplicationsSeatingHelper groupsToApplicationsSeatingHelper, UserManager userManager, com.atlassian.crowd.embedded.api.CrowdService crowdService, GroupLabelsService groupLabels, AuthorisationManager authorisationManager)
-
-
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:UserApplicationHelperReturn theApplicationSelectioncalculated 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:
getApplicationsForSelectionin interfaceUserApplicationHelper- Parameters:
selectedApplicationKeys- the set of application keys to mark as selected.directoryId- optional directoryId to use for application selection- Returns:
- an immutable list of
ApplicationSelectionordered by their name except that JIRA Core is always last.
-
getApplicationsForUser
@Nonnull public List<UserApplicationHelper.ApplicationSelection> getApplicationsForUser(@Nonnull ApplicationUser user) Description copied from interface:UserApplicationHelperReturn theApplicationSelectioncalculated from the current state of JIRA for given (@code ApplicationUser).- Specified by:
getApplicationsForUserin interfaceUserApplicationHelper- Parameters:
user- subject application user to get applications for.- Returns:
- an immutable list of
ApplicationSelectionordered by their name except that JIRA Core is always last.
-
getUserGroups
Description copied from interface:UserApplicationHelperReturn the list ofcom.atlassian.jira.bc.user.GroupViewconnected with the given user. It respects nested groups.- Specified by:
getUserGroupsin interfaceUserApplicationHelper- 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:
validateDefaultApplicationsin interfaceUserApplicationHelper- Parameters:
directoryId- the Directory ID, orOptional.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:
validateApplicationKeysin interfaceUserApplicationHelper- Parameters:
directoryId- the Directory ID, orOptional.empty()if default directory should be checkedapplicationKeys- 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:UserApplicationHelperValidates if adding a user with given application access to given applications won't exceed license limit- Specified by:
validateApplicationKeysin interfaceUserApplicationHelper- Parameters:
user- validated userapplicationKeys- 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:UserApplicationHelperValidates if creating a user with given application access in given directory won't cause issues defined inUserApplicationHelper.ValidationScope- Specified by:
validateApplicationKeysin interfaceUserApplicationHelper- Parameters:
directoryId- the Directory ID, orOptional.empty()if default directory should be checkedapplicationKeys- validated application keysvalidationScope- required validation scope- Returns:
- a collection of errors
-
canUserLogin
Description copied from interface:UserApplicationHelperCheck if given user can login to JIRA. Return true if user has any role or has admin/sysadmin privileges- Specified by:
canUserLoginin interfaceUserApplicationHelper- 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.
-