@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 |
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.
|
void |
changePassword(ApplicationUser user,
String newPassword)
Can be called to set the password for a user.
|
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.
|
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.
|
SortedSet<String> |
getGroupNamesForUser(String userName)
Returns a collection of the names of the groups that the user belongs to.
|
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
Users. |
Collection<ApplicationUser> |
getJiraSystemAdministrators()
Returns a list of JIRA system admin
Users. |
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.
|
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
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.PermissionExceptionAddExceptionvoid 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.PermissionExceptionAddExceptionvoid 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.PermissionExceptionRemoveExceptionvoid 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.PermissionExceptionRemoveExceptionUserUtil.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-onlyPermissionExceptionboolean userExists(String userName)
userName - the name of the userCollection<ApplicationUser> getJiraAdministrators()
Users.
WARNING: This method will be changed in the future to return a Collection of Crowd User
objects. Since v4.3.
Users.Collection<ApplicationUser> getJiraSystemAdministrators()
Users.
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<ProjectComponent> getComponentsUserLeads(ApplicationUser user)
user - User leading componentsCollection<Project> getProjectsLeadBy(ApplicationUser user)
user - the user in playGenericValuesboolean 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 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
orderCopyright © 2002-2023 Atlassian. All Rights Reserved.