|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.atlassian.jira.user.util.UserUtilImpl
public class UserUtilImpl
This is the default implementation of the UserUtil interface.
Field Summary |
---|
Fields inherited from interface com.atlassian.jira.user.util.UserUtil |
---|
META_PROPERTY_PREFIX |
Constructor Summary | |
---|---|
UserUtilImpl(IssueSecurityLevelManager issueSecurityLevelManager,
GlobalPermissionManager globalPermissionManager,
UserManager userManager)
|
Method Summary | |
---|---|
void |
addToJiraUsePermission(User user)
Takes the given user and adds him/her to all the groups that grant a user the global JIRA use permission. |
void |
addUserToGroup(Group group,
User userToAdd)
This is used to add a specified user to a specified group. |
void |
addUserToGroups(Collection groups,
User userToAdd)
This is used to add a user to many groups at once. |
boolean |
canActivateNumberOfUsers(int numUsers)
Returns true if, after adding the specified number of users, the number of active users in JIRA does not exceed the user limit allowed by the license. |
boolean |
canActivateUsers(Collection userNames)
Returns true if, after adding the specified users, the number of active users in JIRA does not exceed the user limit allowed by the license. |
void |
clearActiveUserCount()
Clears the cache of the active user count so that it can be recalculated. |
User |
createJiraUser(String username,
String password,
String email,
String fullname)
Create a JIRA user. |
User |
createJiraUserPreserveCase(String username,
String password,
String email,
String fullname)
Create a JIRA user. |
int |
getActiveUserCount()
Returns the number of users that are currently 'active'. |
Collection |
getAdministrators()
Returns a list of JIRA admin User s. |
protected PortalPageService |
getPortalPageService()
A Factory method to get the PortalPageService. |
protected SearchRequestService |
getSearchRequestService()
A Factory method to get the SearchRequestService. |
protected JiraServiceContext |
getServiceContext(User user)
Protected level factory method to allow for better test integration |
Collection |
getSystemAdministrators()
Returns a list of JIRA system admin User s. |
User |
getUser(String userName)
Returns a user based on user name. |
boolean |
hasExceededUserLimit()
Returns true if this JIRA instance has more active users, than allowed by the license. |
void |
removeUser(User user)
Deletes the user and removes the user from all the groups. |
void |
removeUserFromGroup(Group group,
User userToRemove)
This is used to remove a specified user from a specified group. |
void |
removeUserFromGroups(Collection groups,
User 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 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public UserUtilImpl(IssueSecurityLevelManager issueSecurityLevelManager, GlobalPermissionManager globalPermissionManager, UserManager userManager)
Method Detail |
---|
protected SearchRequestService getSearchRequestService()
protected PortalPageService getPortalPageService()
protected JiraServiceContext getServiceContext(User user)
user
- the user in action
public void addUserToGroup(Group group, User userToAdd)
UserUtil
addUserToGroup
in interface UserUtil
group
- the group to add the user to.userToAdd
- the user to add to the group.public void addUserToGroups(Collection groups, User userToAdd)
UserUtil
addUserToGroups
in interface UserUtil
groups
- a list containing the groups to add the user to.userToAdd
- the user to add to the group.public void removeUserFromGroup(Group group, User userToRemove)
UserUtil
removeUserFromGroup
in interface UserUtil
group
- the group to add the user to.userToRemove
- the user to add to the group.public void removeUserFromGroups(Collection groups, User userToRemove)
UserUtil
removeUserFromGroups
in interface UserUtil
groups
- a list containing the groups to add the user to.userToRemove
- the user to add to the group.public int getActiveUserCount()
UserUtil
UserUtil.clearActiveUserCount()
to clear the cache.
Please note that the calculation will be run if the license does not specify a user limit.
getActiveUserCount
in interface UserUtil
Permissions
public void clearActiveUserCount()
UserUtil
clearActiveUserCount
in interface UserUtil
public boolean hasExceededUserLimit()
UserUtil
hasExceededUserLimit
in interface UserUtil
public boolean canActivateNumberOfUsers(int numUsers)
UserUtil
canActivateNumberOfUsers
in interface UserUtil
numUsers
- 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!
public boolean canActivateUsers(Collection userNames)
UserUtil
canActivateUsers
in interface UserUtil
userNames
- the names of the users to add to the JIRA instance. Must not be null!
public User getUser(String userName)
UserUtil
getUser
in interface UserUtil
userName
- the user name of the user
public boolean userExists(String userName)
UserUtil
userExists
in interface UserUtil
userName
- the name of the user
public Collection getAdministrators()
UserUtil
User
s.
getAdministrators
in interface UserUtil
User
s.public Collection getSystemAdministrators()
UserUtil
User
s.
getSystemAdministrators
in interface UserUtil
Group
's that are associated with the
Permissions.SYSTEM_ADMIN
permission.public User createJiraUser(String username, String password, String email, String fullname) throws DuplicateEntityException, ImmutableException
UserUtil
If password is specified as null, a new password will be generated for the user.
NOTE: This method does not fire any user events, you will need to fire them yourself if you want to.
createJiraUser
in interface UserUtil
username
- the user name for the userpassword
- the password. This may be null to generate a new passwordemail
- the email address of the userfullname
- the user's full name
DuplicateEntityException
- If the user already exists
ImmutableException
- If osuser has been misconfiguredUserUtil.createJiraUserPreserveCase(String, String, String, String)
public User createJiraUserPreserveCase(String username, String password, String email, String fullname) throws DuplicateEntityException, ImmutableException
UserUtil
If password is specified as null, a new password will be generated for the user.
NOTE: This method does not fire any user events, you will need to fire them yourself if you want to.
createJiraUserPreserveCase
in interface UserUtil
username
- the user name for the userpassword
- the password. This may be null to generate a new passwordemail
- the email address of the userfullname
- the user's full name
DuplicateEntityException
- If the user already exists
ImmutableException
- If osuser has been misconfiguredUserUtil.createJiraUser(String, String, String, String)
public void removeUser(User user)
UserUtil
removeUser
in interface UserUtil
user
- the user to deletepublic void addToJiraUsePermission(User user)
UserUtil
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)
addToJiraUsePermission
in interface UserUtil
user
- The user to be added to the USE permission
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |