public class UsersController extends AbstractResourceController
applicationManager, applicationService
Constructor and Description |
---|
UsersController(ApplicationService applicationService,
ApplicationManager applicationManager,
ForgottenLoginManager forgottenLoginManager) |
Modifier and Type | Method and Description |
---|---|
String |
addUser(String applicationName,
UserEntity userEntity)
Adds a new user.
|
void |
addUserToGroup(String applicationName,
String userName,
String groupName)
Adds a user to a group.
|
UserEntity |
findUserByName(String applicationName,
String name,
com.atlassian.plugins.rest.common.Link userLink,
boolean expandAttributes)
Returns a UserEntity specified by the name.
|
GroupEntity |
getDirectGroup(String applicationName,
String userName,
String groupName,
URI baseUri)
Returns the specified group that the user is a direct member of.
|
GroupEntityList |
getDirectGroups(String applicationName,
String userName,
boolean expandGroups,
int maxResults,
int startIndex,
URI baseUri)
Returns the groups that the user is a direct member of.
|
GroupEntity |
getNestedGroup(String applicationName,
String userName,
String groupName,
URI baseUri)
Returns the specified group that the user is a nested member of.
|
GroupEntityList |
getNestedGroups(String applicationName,
String userName,
boolean expandGroups,
int maxResults,
int startIndex,
URI baseUri)
Returns the groups that the user is a nested member of.
|
void |
removeUser(String applicationName,
String username)
Removes the user.
|
void |
removeUserAttribute(String applicationName,
String username,
String attributeName)
Removes the user attribute.
|
void |
removeUserFromGroup(String applicationName,
String userName,
String groupName)
Removes a user from a group.
|
void |
requestPasswordReset(String applicationName,
String username)
Requests a password reset.
|
boolean |
requestUsernames(String applicationName,
String email)
Requests an email to be sent containing usernames associated with the given email address.
|
void |
storeUserAttributes(String applicationName,
String username,
MultiValuedAttributeEntityList attributes)
Stores (add/replace) the user attributes.
|
String |
updateUser(String applicationName,
UserEntity userEntity)
Updates a user.
|
void |
updateUserPassword(String applicationName,
String username,
String password)
Updates a user's password.
|
getApplication
public UsersController(ApplicationService applicationService, ApplicationManager applicationManager, ForgottenLoginManager forgottenLoginManager)
public UserEntity findUserByName(String applicationName, String name, com.atlassian.plugins.rest.common.Link userLink, boolean expandAttributes) throws UserNotFoundException
applicationName
- name of the applicationname
- name of the user to retrieveuserLink
- link to the user resourceexpandAttributes
- set to true if the attributes field should be expandedUserNotFoundException
- if the user could not be foundpublic String addUser(String applicationName, UserEntity userEntity) throws ApplicationPermissionException, InvalidUserException, InvalidCredentialException, OperationFailedException
applicationName
- name of the applicationuserEntity
- new user to addApplicationPermissionException
- if none of the application's underlying directories are allowed to perform this operationOperationFailedException
- if the operation failed for any other reasonInvalidCredentialException
- if the password is not validInvalidUserException
- if the user is not validpublic String updateUser(String applicationName, UserEntity userEntity) throws ApplicationPermissionException, InvalidUserException, UserNotFoundException, OperationFailedException
applicationName
- name of the applicationuserEntity
- updated user informationApplicationPermissionException
- if none of the application's underlying directories are allowed to perform this operationInvalidUserException
- if the user template does not have the required properties populated.UserNotFoundException
- if the user was not foundOperationFailedException
- if the operation failed for any other reasonpublic void storeUserAttributes(String applicationName, String username, MultiValuedAttributeEntityList attributes) throws ApplicationPermissionException, UserNotFoundException, OperationFailedException
applicationName
- name of the applicationusername
- name of the userattributes
- attributes of the userApplicationPermissionException
- if none of the application's underlying directories are allowed to perform this operationOperationFailedException
- if the operation failed for any other reasonUserNotFoundException
- if the user could not be foundpublic void removeUserAttribute(String applicationName, String username, String attributeName) throws ApplicationPermissionException, UserNotFoundException, OperationFailedException
applicationName
- name of the applicationusername
- name of the userattributeName
- name of attribute to removeApplicationPermissionException
- if none of the application's underlying directories have permission to perform the operationOperationFailedException
- if the operation failed for any other reasonUserNotFoundException
- if the user could not be foundpublic void requestPasswordReset(String applicationName, String username) throws InvalidEmailAddressException, ApplicationPermissionException, ApplicationNotFoundException, UserNotFoundException
applicationName
- name of the applicationusername
- name of the userUserNotFoundException
- if the user could not be foundInvalidEmailAddressException
- if the user does not have a valid email to send the reset password link toApplicationPermissionException
- if none of the application's underlying directories can update the user's passwordApplicationNotFoundException
- if the application could not be foundpublic boolean requestUsernames(String applicationName, String email) throws InvalidEmailAddressException, ApplicationNotFoundException
applicationName
- name of the applicationemail
- email address of the userInvalidEmailAddressException
- if the email
is not validApplicationNotFoundException
- if the application could not be foundpublic void removeUser(String applicationName, String username) throws ApplicationPermissionException, UserNotFoundException, OperationFailedException
applicationName
- name of the applicationusername
- name of the userApplicationPermissionException
- if none of the application's underlying directories can update the user's passwordOperationFailedException
- if the operation failed for any other reasonUserNotFoundException
- if the user could not be foundpublic void updateUserPassword(String applicationName, String username, String password) throws ApplicationPermissionException, UserNotFoundException, InvalidCredentialException, OperationFailedException
applicationName
- name of the applicationusername
- name of the userpassword
- new passwordApplicationPermissionException
- if none of the application's underlying directories are allowed to perform this operationUserNotFoundException
- if the user was not foundOperationFailedException
- if the operation failed for any other reasonInvalidCredentialException
- if the new password is not validpublic GroupEntityList getDirectGroups(String applicationName, String userName, boolean expandGroups, int maxResults, int startIndex, URI baseUri)
applicationName
- name of the applicationuserName
- name of the userexpandGroups
- should groups be expandedmaxResults
- maximum number of results returned. If -1, then all the results are returned.startIndex
- starting index of the resultsbaseUri
- base URI of the REST servicepublic GroupEntity getDirectGroup(String applicationName, String userName, String groupName, URI baseUri) throws MembershipNotFoundException
applicationName
- name of the applicationuserName
- name of the usergroupName
- name of the group the user is a member ofbaseUri
- base URI of the REST serviceMembershipNotFoundException
- if the membership was not foundpublic void addUserToGroup(String applicationName, String userName, String groupName) throws ApplicationPermissionException, UserNotFoundException, GroupNotFoundException, OperationFailedException
applicationName
- name of the applicationuserName
- name of the usergroupName
- name of the groupApplicationPermissionException
- if none of the application's associated directories are allowed to perform operations of type OperationType.UPDATE_GROUP
.UserNotFoundException
- if the user could not be foundGroupNotFoundException
- if the group could not be foundOperationFailedException
- if the operation failed for any other reasonpublic void removeUserFromGroup(String applicationName, String userName, String groupName) throws ApplicationPermissionException, MembershipNotFoundException, UserNotFoundException, GroupNotFoundException, OperationFailedException
applicationName
- name of the applicationuserName
- name of the usergroupName
- name of the groupApplicationPermissionException
- if none of the application's associated directories are allowed to perform operations of type OperationType.UPDATE_GROUP
.GroupNotFoundException
- if the group could not be foundMembershipNotFoundException
- if the membership does not existUserNotFoundException
- if the user could not be foundOperationFailedException
- if the operation failed for any other reasonpublic GroupEntityList getNestedGroups(String applicationName, String userName, boolean expandGroups, int maxResults, int startIndex, URI baseUri)
applicationName
- name of the applicationuserName
- name of the userexpandGroups
- should groups be expandedmaxResults
- maximum number of results returned. If -1, then all the results are returned.startIndex
- starting index of the resultsbaseUri
- base URI of the REST servicepublic GroupEntity getNestedGroup(String applicationName, String userName, String groupName, URI baseUri) throws MembershipNotFoundException
applicationName
- name of the applicationuserName
- name of the usergroupName
- name of the group the user is a member ofbaseUri
- base URI of the REST serviceMembershipNotFoundException
- if the membership was not foundCopyright © 2013 Atlassian. All Rights Reserved.