UserUtil.PasswordResetToken, UserUtil.PasswordResetTokenValidation| Modifier and Type | Field and Description |
|---|---|
static String |
DIRECTORY_ID |
static String |
DIRECTORY_NAME |
static String |
DISPLAY_NAME |
static String |
EMAIL |
static String |
PASSWORD_HOURS |
static String |
PASSWORD_TOKEN |
static String |
SEND_EMAIL |
static String |
USERNAME |
META_PROPERTY_PREFIX| Constructor and Description |
|---|
UserUtilImpl(IssueSecurityLevelManager issueSecurityLevelManager,
GlobalPermissionManager globalPermissionManager,
com.atlassian.crowd.embedded.api.CrowdService crowdService,
PermissionManager permissionManager,
ApplicationProperties applicationProperties,
SearchService searchService,
ProjectManager projectManager,
ProjectRoleService projectRoleService,
ProjectComponentManager componentManager,
SubscriptionManager subscriptionManager,
NotificationSchemeManager notificationSchemeManager,
UserHistoryManager userHistoryManager,
UserManager userManager,
ApplicationRoleManager applicationRoleManager,
JsonEntityPropertyManager jsonEntityPropertyManager,
SharePermissionDeleteUtils sharePermissionDeleteUtils) |
| 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
|
protected PortalPageService |
getPortalPageService()
A Factory method to get the PortalPageService.
|
Collection<Project> |
getProjectsLeadBy(ApplicationUser user)
Returns all the projects that leadUser is the project lead for.
|
protected SearchRequestService |
getSearchRequestService()
A Factory method to get the SearchRequestService.
|
protected JiraServiceContext |
getServiceContext(ApplicationUser user)
Protected level factory method to allow for better test integration
|
SortedSet<ApplicationUser> |
getUsersInGroupNames(Collection<String> groupNames) |
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.
|
public static final String USERNAME
public static final String EMAIL
public static final String DISPLAY_NAME
public static final String DIRECTORY_NAME
public static final String DIRECTORY_ID
public static final String PASSWORD_TOKEN
public static final String PASSWORD_HOURS
public static final String SEND_EMAIL
public UserUtilImpl(IssueSecurityLevelManager issueSecurityLevelManager, GlobalPermissionManager globalPermissionManager, com.atlassian.crowd.embedded.api.CrowdService crowdService, PermissionManager permissionManager, ApplicationProperties applicationProperties, SearchService searchService, ProjectManager projectManager, ProjectRoleService projectRoleService, ProjectComponentManager componentManager, SubscriptionManager subscriptionManager, NotificationSchemeManager notificationSchemeManager, UserHistoryManager userHistoryManager, UserManager userManager, ApplicationRoleManager applicationRoleManager, JsonEntityPropertyManager jsonEntityPropertyManager, SharePermissionDeleteUtils sharePermissionDeleteUtils)
protected SearchRequestService getSearchRequestService()
protected PortalPageService getPortalPageService()
protected JiraServiceContext getServiceContext(ApplicationUser user)
user - the user in actionpublic void removeUser(ApplicationUser loggedInUser, ApplicationUser user)
UserUtilremoveUser in interface UserUtilloggedInUser - the user performing operationuser - the user to deletepublic long getNumberOfReportedIssuesIgnoreSecurity(ApplicationUser loggedInUser, ApplicationUser user) throws SearchException
UserUtilgetNumberOfReportedIssuesIgnoreSecurity in interface UserUtilloggedInUser - the logged in useruser - the user to find the issue count forSearchException - if something goes wrongpublic long getNumberOfAssignedIssuesIgnoreSecurity(ApplicationUser loggedInUser, ApplicationUser user) throws SearchException
UserUtilgetNumberOfAssignedIssuesIgnoreSecurity in interface UserUtilloggedInUser - the logged in useruser - the user to find the issue count forSearchException - if something goes wrongpublic Collection<ProjectComponent> getComponentsUserLeads(ApplicationUser user)
UserUtilgetComponentsUserLeads in interface UserUtiluser - User leading componentspublic Collection<Project> getProjectsLeadBy(ApplicationUser user)
UserUtilgetProjectsLeadBy in interface UserUtiluser - the user in playGenericValuespublic boolean isNonSysAdminAttemptingToDeleteSysAdmin(ApplicationUser loggedInUser, ApplicationUser user)
UserUtilisNonSysAdminAttemptingToDeleteSysAdmin in interface UserUtilloggedInUser - User performing operationuser - User for removepublic void addUserToGroup(com.atlassian.crowd.embedded.api.Group group,
ApplicationUser userToAdd)
throws PermissionException,
AddException
UserUtiladdUserToGroup in interface UserUtilgroup - the group to add the user to.userToAdd - the user to add to the group.PermissionExceptionAddExceptionpublic void addUserToGroups(Collection<com.atlassian.crowd.embedded.api.Group> groups, ApplicationUser userToAdd) throws PermissionException, AddException
UserUtiladdUserToGroups in interface UserUtilgroups - a list containing the groups to add the user to.userToAdd - the user to add to the group.PermissionExceptionAddExceptionpublic void removeUserFromGroup(com.atlassian.crowd.embedded.api.Group group,
ApplicationUser userToRemove)
throws PermissionException,
RemoveException
UserUtilremoveUserFromGroup in interface UserUtilgroup - the group to add the user to.userToRemove - the user to add to the group.PermissionExceptionRemoveExceptionpublic void removeUserFromGroups(Collection<com.atlassian.crowd.embedded.api.Group> groups, ApplicationUser userToRemove) throws PermissionException, RemoveException
UserUtilremoveUserFromGroups in interface UserUtilgroups - a list containing the groups to add the user to.userToRemove - the user to add to the group.PermissionExceptionRemoveExceptionpublic UserUtil.PasswordResetToken generatePasswordResetToken(ApplicationUser user)
UserUtilThe generated token will be associated with the named user so that that this information can be verified at a later time.
generatePasswordResetToken in interface UserUtiluser - the user in question. This MUST not be nullpublic UserUtil.PasswordResetTokenValidation validatePasswordResetToken(ApplicationUser user, String token)
UserUtilvalidatePasswordResetToken in interface UserUtiluser - the user in playtoken - the token they providedpublic void changePassword(ApplicationUser user, String newPassword) throws PermissionException, com.atlassian.crowd.exception.InvalidCredentialException
UserUtilchangePassword in interface UserUtiluser - the user in playnewPassword - their new passwordcom.atlassian.crowd.exception.InvalidCredentialException - if the password is invalidPermissionExceptionpublic boolean userExists(String userName)
UserUtiluserExists in interface UserUtiluserName - the name of the userpublic Collection<ApplicationUser> getJiraAdministrators()
UserUtilUsers.
WARNING: This method will be changed in the future to return a Collection of Crowd User
objects. Since v4.3.
getJiraAdministrators in interface UserUtilUsers.public Collection<ApplicationUser> getJiraSystemAdministrators()
UserUtilUsers.
WARNING: This method will be changed in the future to return a Collection of Crowd User
objects. Since v4.3.
getJiraSystemAdministrators in interface UserUtilUser's that are associated with the Permissions.SYSTEM_ADMIN
permission.public String getDisplayableNameSafely(ApplicationUser user)
UserUtilgetDisplayableNameSafely in interface UserUtiluser - the user. May be null.public SortedSet<ApplicationUser> getAllUsersInGroups(Collection<com.atlassian.crowd.embedded.api.Group> groups)
UserUtilUser objects that are found within the passed in collection of Group
objects.getAllUsersInGroups in interface UserUtilgroups - a collection of Group objectsUserCachingComparator
orderpublic SortedSet<ApplicationUser> getAllUsersInGroupNames(Collection<String> groupNames)
UserUtilUser objects that belong to any of the passed in collection of group names.
Prefer using UserUtil.getAllUsersInGroupNamesUnsorted(java.util.Collection) and sorting the list of users only if
absolutely necessary rather than relying on this method to perform the sort.getAllUsersInGroupNames in interface UserUtilgroupNames - a collection of group name stringsUserCachingComparator
orderpublic Set<ApplicationUser> getAllUsersInGroupNamesUnsorted(Collection<String> groupNames)
UserUtilUser objects that belong to any of the passed in collection of group names.getAllUsersInGroupNamesUnsorted in interface UserUtilgroupNames - a collection of group name stringspublic SortedSet<ApplicationUser> getUsersInGroupNames(Collection<String> groupNames)
public SortedSet<com.atlassian.crowd.embedded.api.Group> getGroupsForUser(String userName)
UserUtilGroup objects that the user belongs to.getGroupsForUser in interface UserUtiluserName - A User namepublic SortedSet<String> getGroupNamesForUser(String userName)
UserUtilgetGroupNamesForUser in interface UserUtiluserName - A User nameCopyright © 2002-2023 Atlassian. All Rights Reserved.