@PublicApi
public interface UserUtil
In general, appropriate managers or services should be used in preference to this class, as it will be removed in some future revision of JIRA.
UserService
,
UserManager
,
GroupService
,
GroupManager
Modifier and Type | Interface and Description |
---|---|
static interface |
UserUtil.PasswordResetToken |
static interface |
UserUtil.PasswordResetTokenValidation |
Modifier and Type | Field and Description |
---|---|
static String |
META_PROPERTY_PREFIX |
Modifier and Type | Method and Description |
---|---|
void |
addToJiraUsePermission(ApplicationUser user)
Deprecated.
|
void |
addUserToGroup(com.atlassian.crowd.embedded.api.Group group,
ApplicationUser userToAdd)
This is used to add a specified user to a specified group.
|
void |
addUserToGroups(Collection<com.atlassian.crowd.embedded.api.Group> groups,
ApplicationUser userToAdd)
This is used to add a user to many groups at once.
|
boolean |
canActivateNumberOfUsers(int numUsers)
Deprecated.
Use
ApplicationRoleManager.hasSeatsAvailable(ApplicationKey, int)
instead. Since v7.0 |
void |
changePassword(ApplicationUser user,
String newPassword)
Can be called to set the password for a user.
|
void |
clearActiveUserCount()
Deprecated.
since 6.5. Use
LicenseCountService.flush() instead. |
ApplicationUser |
createUser(UserDetails userData,
boolean sendEmail,
int eventType,
Set<com.atlassian.application.api.ApplicationKey> applicationKeys)
Deprecated.
Use
UserService.createUser(CreateUserValidationResult) instead. Since v7.0. |
ApplicationUser |
createUserNoNotification(String username,
String password,
String emailAddress,
String displayName)
Deprecated.
Use
UserService.createUser(CreateUserValidationResult) instead. Since v7.0. |
ApplicationUser |
createUserNoNotification(String username,
String password,
String emailAddress,
String displayName,
Long directoryId)
Deprecated.
Use
UserService.createUser(CreateUserValidationResult) instead. Since v7.0. |
ApplicationUser |
createUserWithNotification(String username,
String password,
String email,
String fullname,
int userEventType)
Deprecated.
Use
UserService.createUser(CreateUserValidationResult) instead. Since v7.0. |
ApplicationUser |
createUserWithNotification(String username,
String password,
String email,
String fullname,
Long directoryId,
int userEventType)
Deprecated.
Use
UserService.createUser(CreateUserValidationResult) instead. Since v7.0. |
UserUtil.PasswordResetToken |
generatePasswordResetToken(ApplicationUser user)
This is used to generate a reset password token that last a certain time and allows a person to access a page
anonymously so they can reset their password.
|
int |
getActiveUserCount()
Deprecated.
use
LicenseCountService.totalBillableUsers() . since 6.5 |
Collection<ApplicationUser> |
getAdministrators()
Deprecated.
Since v4.3. Use
getJiraAdministrators() . |
Collection<ApplicationUser> |
getAllApplicationUsers()
Deprecated.
Use
UserManager.getAllApplicationUsers() instead. Since v6.5. |
SortedSet<ApplicationUser> |
getAllUsersInGroupNames(Collection<String> groupNames)
Returns a collection of
User objects that belong to any of the passed in collection of group names. |
Set<ApplicationUser> |
getAllUsersInGroupNamesUnsorted(Collection<String> groupNames)
Returns a collection of
User objects that belong to any of the passed in collection of group names. |
SortedSet<ApplicationUser> |
getAllUsersInGroups(Collection<com.atlassian.crowd.embedded.api.Group> groups)
Returns a collection of
User objects that are found within the passed in collection of Group
objects. |
Collection<ProjectComponent> |
getComponentsUserLeads(ApplicationUser user)
Retrieve a collection of ProjectComponents - where the lead of each component is the specified user.
|
String |
getDisplayableNameSafely(ApplicationUser user)
Takes the given user and returns a "displayable name" by cautiously checking the different edge cases for users.
|
com.atlassian.crowd.embedded.api.Group |
getGroup(String groupName)
Deprecated.
Since v4.3. Use
GroupManager.getGroup(java.lang.String) instead. |
SortedSet<String> |
getGroupNamesForUser(String userName)
Returns a collection of the names of the groups that the user belongs to.
|
com.atlassian.crowd.embedded.api.Group |
getGroupObject(String groupName)
Deprecated.
since 6.5. Use
GroupManager.getGroup(java.lang.String) instead. |
SortedSet<com.atlassian.crowd.embedded.api.Group> |
getGroupsForUser(String userName)
Returns a collection of
Group objects that the user belongs to. |
Collection<ApplicationUser> |
getJiraAdministrators()
Returns a list of JIRA admin
User s. |
Collection<ApplicationUser> |
getJiraSystemAdministrators()
Returns a list of JIRA system admin
User s. |
long |
getNumberOfAssignedIssuesIgnoreSecurity(ApplicationUser loggedInUser,
ApplicationUser user)
Returns number of issues assigned to user
|
long |
getNumberOfReportedIssuesIgnoreSecurity(ApplicationUser loggedInUser,
ApplicationUser user)
Returns number of issues reported by user
|
Collection<Project> |
getProjectsLeadBy(ApplicationUser user)
Returns all the projects that leadUser is the project lead for.
|
Collection<ApplicationUser> |
getSystemAdministrators()
Deprecated.
Since v4.3. Use
getJiraSystemAdministrators() . |
int |
getTotalUserCount()
Deprecated.
Use
UserManager.getTotalUserCount() instead. Since 7.0. |
ApplicationUser |
getUser(String userName)
Deprecated.
Use
getUserByKey(String) or getUserByName(String) instead. Since v6.0. |
ApplicationUser |
getUserByKey(String userkey)
Deprecated.
use
UserManager.getUserByKey(String) . since 7.0 |
ApplicationUser |
getUserByName(String username)
Deprecated.
use
UserManager.getUserByName(String) . since 7.0 |
ApplicationUser |
getUserObject(String userName)
Deprecated.
Use
getUserByKey(String) or getUserByName(String) instead. Since v6.0. |
Collection<ApplicationUser> |
getUsers()
Deprecated.
Use
UserManager.getAllApplicationUsers() instead. Since v6.5. |
SortedSet<ApplicationUser> |
getUsersInGroupNames(Collection<String> groupNames)
Deprecated.
Use
getAllUsersInGroupNames(java.util.Collection) instead. Since v4.3 |
SortedSet<ApplicationUser> |
getUsersInGroups(Collection<com.atlassian.crowd.embedded.api.Group> groups)
Deprecated.
Use
getAllUsersInGroups(java.util.Collection) instead. Since v4.3 |
boolean |
isNonSysAdminAttemptingToDeleteSysAdmin(ApplicationUser loggedInUser,
ApplicationUser user)
Checking if user without SYSTEM_ADMIN rights tries to remove user with SYSTEM_ADMIN rights.
|
void |
removeUser(ApplicationUser loggedInUser,
ApplicationUser user)
This will remove the user and removes the user from all the groups.
|
void |
removeUserFromGroup(com.atlassian.crowd.embedded.api.Group group,
ApplicationUser userToRemove)
This is used to remove a specified user from a specified group.
|
void |
removeUserFromGroups(Collection<com.atlassian.crowd.embedded.api.Group> groups,
ApplicationUser userToRemove)
This is used to remove a user from many groups at once.
|
boolean |
userExists(String userName)
Returns true if the a user exists with the specified userName
|
UserUtil.PasswordResetTokenValidation |
validatePasswordResetToken(ApplicationUser user,
String token)
This can be called to validate a token against the user.
|
static final String META_PROPERTY_PREFIX
@Deprecated int getTotalUserCount()
UserManager.getTotalUserCount()
instead. Since 7.0.@Deprecated void clearActiveUserCount()
LicenseCountService.flush()
instead.@Deprecated @Nonnull Collection<ApplicationUser> getUsers()
UserManager.getAllApplicationUsers()
instead. Since v6.5.@Deprecated @Nonnull Collection<ApplicationUser> getAllApplicationUsers()
UserManager.getAllApplicationUsers()
instead. Since v6.5.@Deprecated @Nullable com.atlassian.crowd.embedded.api.Group getGroup(@Nullable String groupName)
GroupManager.getGroup(java.lang.String)
instead.Group
based on group name.groupName
- the user name of the group@Deprecated @Nullable com.atlassian.crowd.embedded.api.Group getGroupObject(@Nullable String groupName)
GroupManager.getGroup(java.lang.String)
instead.Group
based on group name.groupName
- the user name of the group@Deprecated @Nonnull ApplicationUser createUserWithNotification(String username, String password, String email, String fullname, int userEventType) throws PermissionException, CreateException
UserService.createUser(CreateUserValidationResult)
instead. Since v7.0.Email notification will be send to created user.
username
- The username of the new user. Needs to be lowercase and unique.password
- The password for the new user.email
- The email for the new user. Needs to be a valid email address.fullname
- The full name for the new useruserEventType
- The event type dispatched on user creation. Either UserEventType.USER_CREATED
or UserEventType.USER_SIGNUP
PermissionException
- If the operation was not permitted.CreateException
@Deprecated @Nonnull ApplicationUser createUserWithNotification(String username, String password, String email, String fullname, Long directoryId, int userEventType) throws PermissionException, CreateException
UserService.createUser(CreateUserValidationResult)
instead. Since v7.0.Email notification will be send to created user.
username
- The username of the new user. Needs to be lowercase and unique.password
- The password for the new user.email
- The email for the new user. Needs to be a valid email address.fullname
- The full name for the new userdirectoryId
- The directory to create the user in. Null means "first writable directory".userEventType
- The event type dispatched on user creation. Either UserEventType.USER_CREATED
or UserEventType.USER_SIGNUP
PermissionException
- If the operation was not permitted.CreateException
@Deprecated @Nonnull ApplicationUser createUserNoNotification(String username, String password, String emailAddress, String displayName) throws PermissionException, CreateException
UserService.createUser(CreateUserValidationResult)
instead. Since v7.0.No email notification will be send to created user.
username
- The username of the new user. Needs to be lowercase and unique.password
- The password for the new user.emailAddress
- The email for the new user. Needs to be a valid email address.displayName
- The display name for the new userPermissionException
- If the operation was not permitted.CreateException
@Deprecated @Nonnull ApplicationUser createUserNoNotification(String username, String password, String emailAddress, String displayName, Long directoryId) throws PermissionException, CreateException
UserService.createUser(CreateUserValidationResult)
instead. Since v7.0.No email notification will be send to created user.
username
- The username of the new user. Needs to be lowercase and unique.password
- The password for the new user.emailAddress
- The email for the new user. Needs to be a valid email address.displayName
- The display name for the new userdirectoryId
- The directory to create the user in. Null means "first writable directory".PermissionException
- If the operation was not permitted.CreateException
@Nonnull @Internal @ExperimentalApi @Deprecated ApplicationUser createUser(@Nonnull UserDetails userData, boolean sendEmail, int eventType, @Nullable Set<com.atlassian.application.api.ApplicationKey> applicationKeys) throws PermissionException, CreateException
UserService.createUser(CreateUserValidationResult)
instead. Since v7.0.UserService
.
Creates a JIRA user.userData
- user request containing user details.sendEmail
- should send email notification.eventType
- notification event type (see to UserEventType
).applicationKeys
- applications that user should be granted access to,
null
if instance default applications should be used,
empty Set when user does not require access to any applications.PermissionException
- If the operation was not permitted.CreateException
- Unable to create user.void removeUser(ApplicationUser loggedInUser, ApplicationUser user)
loggedInUser
- the user performing operationuser
- the user to deletevoid addUserToGroup(com.atlassian.crowd.embedded.api.Group group, ApplicationUser userToAdd) throws PermissionException, AddException
group
- the group to add the user to.userToAdd
- the user to add to the group.PermissionException
AddException
void addUserToGroups(Collection<com.atlassian.crowd.embedded.api.Group> groups, ApplicationUser userToAdd) throws PermissionException, AddException
groups
- a list containing the groups to add the user to.userToAdd
- the user to add to the group.PermissionException
AddException
void removeUserFromGroup(com.atlassian.crowd.embedded.api.Group group, ApplicationUser userToRemove) throws PermissionException, RemoveException
group
- the group to add the user to.userToRemove
- the user to add to the group.PermissionException
RemoveException
void removeUserFromGroups(Collection<com.atlassian.crowd.embedded.api.Group> groups, ApplicationUser userToRemove) throws PermissionException, RemoveException
groups
- a list containing the groups to add the user to.userToRemove
- the user to add to the group.PermissionException
RemoveException
UserUtil.PasswordResetToken generatePasswordResetToken(ApplicationUser user)
The generated token will be associated with the named user so that that this information can be verified at a later time.
user
- the user in question. This MUST not be nullUserUtil.PasswordResetTokenValidation validatePasswordResetToken(ApplicationUser user, String token)
user
- the user in playtoken
- the token they providedvoid changePassword(ApplicationUser user, String newPassword) throws com.atlassian.crowd.exception.UserNotFoundException, com.atlassian.crowd.exception.InvalidCredentialException, com.atlassian.crowd.exception.OperationNotPermittedException, PermissionException
user
- the user in playnewPassword
- their new passwordcom.atlassian.crowd.exception.UserNotFoundException
- if the user does not existcom.atlassian.crowd.exception.InvalidCredentialException
- if the password is invalidcom.atlassian.crowd.exception.OperationNotPermittedException
- if the underlying User Directory is read-onlyPermissionException
@Deprecated int getActiveUserCount()
LicenseCountService.totalBillableUsers()
. since 6.5In all cases this method will exclude Connect users from the count. In Cloud this will also exclude users who exist for the purpose of providing support (such as the Atlassian sysadmin user).
Permissions
@Deprecated boolean canActivateNumberOfUsers(int numUsers)
ApplicationRoleManager.hasSeatsAvailable(ApplicationKey, int)
instead. Since v7.0numUsers
- the number of users to add to the JIRA instance. If 0, all things being equal, this method will
return true. Must not be negative!@Deprecated @Nullable ApplicationUser getUser(String userName)
getUserByKey(String)
or getUserByName(String)
instead. Since v6.0.userName
- the user name of the user@Deprecated @Nullable ApplicationUser getUserByKey(@Nullable String userkey)
UserManager.getUserByKey(String)
. since 7.0userkey
- the key of the user@Deprecated @Nullable ApplicationUser getUserByName(String username)
UserManager.getUserByName(String)
. since 7.0username
- the user name of the user@Deprecated @Nullable ApplicationUser getUserObject(String userName)
getUserByKey(String)
or getUserByName(String)
instead. Since v6.0.userName
- the user name of the userboolean userExists(String userName)
userName
- the name of the user@Deprecated Collection<ApplicationUser> getAdministrators()
getJiraAdministrators()
.User
s.
WARNING: This method will be changed in the future to return a Collection of Crowd User
objects. Since v4.3.
User
s.Collection<ApplicationUser> getJiraAdministrators()
User
s.
WARNING: This method will be changed in the future to return a Collection of Crowd User
objects. Since v4.3.
User
s.@Deprecated Collection<ApplicationUser> getSystemAdministrators()
getJiraSystemAdministrators()
.User
s.
WARNING: This method will be changed in the future to return a Collection of Crowd User
objects. Since v4.3.
User
's that are associated with the Permissions.SYSTEM_ADMIN
permission.Collection<ApplicationUser> getJiraSystemAdministrators()
User
s.
WARNING: This method will be changed in the future to return a Collection of Crowd User
objects. Since v4.3.
User
's that are associated with the Permissions.SYSTEM_ADMIN
permission.@Deprecated void addToJiraUsePermission(ApplicationUser user) throws PermissionException
UserService.validateAddUserToApplication(ApplicationUser, ApplicationKey)
then
UserService.addUserToApplication(AddUserToApplicationValidationResult)
instead. Since v7.0.Permissions.USE
) Note: operation is only performed if by doing so we will not
exceed the user limit (if the current license happens to specify a limit)user
- The user to be added to the USE permissionPermissionException
Collection<ProjectComponent> getComponentsUserLeads(ApplicationUser user)
user
- User leading componentsCollection<Project> getProjectsLeadBy(ApplicationUser user)
user
- the user in playGenericValue
sboolean isNonSysAdminAttemptingToDeleteSysAdmin(ApplicationUser loggedInUser, ApplicationUser user)
loggedInUser
- User performing operationuser
- User for removelong getNumberOfReportedIssuesIgnoreSecurity(ApplicationUser loggedInUser, ApplicationUser user) throws SearchException
loggedInUser
- the logged in useruser
- the user to find the issue count forSearchException
- if something goes wronglong getNumberOfAssignedIssuesIgnoreSecurity(ApplicationUser loggedInUser, ApplicationUser user) throws SearchException
loggedInUser
- the logged in useruser
- the user to find the issue count forSearchException
- if something goes wrongString getDisplayableNameSafely(ApplicationUser user)
user
- the user. May be null.SortedSet<com.atlassian.crowd.embedded.api.Group> getGroupsForUser(String userName)
Group
objects that the user belongs to.userName
- A User nameSortedSet<String> getGroupNamesForUser(String userName)
userName
- A User nameSortedSet<ApplicationUser> getAllUsersInGroupNames(Collection<String> groupNames)
User
objects that belong to any of the passed in collection of group names.
Prefer using getAllUsersInGroupNamesUnsorted(java.util.Collection)
and sorting the list of users only if
absolutely necessary rather than relying on this method to perform the sort.groupNames
- a collection of group name stringsUserCachingComparator
orderSet<ApplicationUser> getAllUsersInGroupNamesUnsorted(Collection<String> groupNames)
User
objects that belong to any of the passed in collection of group names.groupNames
- a collection of group name strings@Deprecated SortedSet<ApplicationUser> getUsersInGroupNames(Collection<String> groupNames)
getAllUsersInGroupNames(java.util.Collection)
instead. Since v4.3User
objects that are found within the passed in collection of group names. Null
users are excluded even if they exist in the underlying data.groupNames
- a collection of group name stringsSortedSet<ApplicationUser> getAllUsersInGroups(Collection<com.atlassian.crowd.embedded.api.Group> groups)
User
objects that are found within the passed in collection of Group
objects.groups
- a collection of Group
objectsUserCachingComparator
order@Deprecated SortedSet<ApplicationUser> getUsersInGroups(Collection<com.atlassian.crowd.embedded.api.Group> groups)
getAllUsersInGroups(java.util.Collection)
instead. Since v4.3User
objects that are found within the passed in collection of Group
objects. Null users are excluded even if they exist in the underlying data.groups
- a collection of Group
objectsUserCachingComparator
orderCopyright © 2002-2021 Atlassian. All Rights Reserved.