public class UsersController extends AbstractResourceController
applicationManager, applicationService
Constructor and Description |
---|
UsersController(ApplicationService applicationService,
ApplicationManager applicationManager,
ForgottenLoginManager forgottenLoginManager) |
Modifier and Type | Method and Description |
---|---|
UserEntity |
addUser(String applicationName,
UserEntity userEntity,
com.atlassian.plugins.rest.common.Link userLink)
Adds a new user.
|
void |
addUserToGroup(String applicationName,
String userName,
String groupName)
Adds a user to a group.
|
void |
clearUserPassword(String applicationName,
String username)
Clears a user's password, so that the user cannot authenticate with any password.
|
void |
expireAllPasswords(String applicationName)
Expires all passwords for all directories which are part of this application, regardless of
group mapping.
|
UserEntity |
findUserByKey(String applicationName,
String key,
com.atlassian.plugins.rest.common.Link userLink,
boolean expandAttributes) |
UserEntity |
findUserByName(String applicationName,
String name,
com.atlassian.plugins.rest.common.Link userLink,
boolean expandAttributes)
Returns a UserEntity specified by the name.
|
URI |
getAvatarForUser(String applicationName,
String username,
int sizeHint) |
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,
boolean expandAttributes,
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.
|
UserEntity |
renameUser(String applicationName,
String oldUsername,
com.atlassian.plugins.rest.common.Link userLink,
String newUsername)
Renames a user.
|
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 UserEntity findUserByKey(String applicationName, String key, com.atlassian.plugins.rest.common.Link userLink, boolean expandAttributes) throws UserNotFoundException
UserNotFoundException
public UserEntity addUser(String applicationName, UserEntity userEntity, com.atlassian.plugins.rest.common.Link userLink) throws ApplicationPermissionException, InvalidUserException, InvalidCredentialException, OperationFailedException
applicationName
- name of the applicationuserEntity
- new user to adduserLink
- preliminary link to the user resourceUserWithAttributes
represented within a UserEntity
ApplicationPermissionException
- 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 valid or already existspublic 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 usertrue
if any users with that address were found.InvalidEmailAddressException
- 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 UserEntity renameUser(String applicationName, String oldUsername, com.atlassian.plugins.rest.common.Link userLink, String newUsername) throws ApplicationPermissionException, InvalidUserException, UserNotFoundException, OperationFailedException
applicationName
- name of the applicationoldUsername
- current name of the user to renamenewUsername
- the intended new name of the userApplicationPermissionException
- 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 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 void clearUserPassword(String applicationName, String username) throws ApplicationPermissionException, UserNotFoundException, InvalidCredentialException, OperationFailedException
applicationName
- name of the applicationusername
- name of the userApplicationPermissionException
- 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 void expireAllPasswords(String applicationName) throws OperationFailedException
applicationName
- the application name for which to expire all passwords in all
mapped directories.OperationFailedException
- if any of the directories fail to expire all passwords. This
can lead to only some of the users having expired passwords.public GroupEntityList getDirectGroups(String applicationName, String userName, boolean expandGroups, boolean expandAttributes, int maxResults, int startIndex, URI baseUri) throws UserNotFoundException
applicationName
- name of the applicationuserName
- name of the userexpandGroups
- should groups be expandedexpandAttributes
- should the attributes of the group 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 serviceUserNotFoundException
public GroupEntity getDirectGroup(String applicationName, String userName, String groupName, URI baseUri) throws MembershipNotFoundException, UserNotFoundException
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 foundUserNotFoundException
public void addUserToGroup(String applicationName, String userName, String groupName) throws ApplicationPermissionException, UserNotFoundException, GroupNotFoundException, OperationFailedException, MembershipAlreadyExistsException
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 foundMembershipAlreadyExistsException
- if the user is already a member of the groupOperationFailedException
- 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) throws UserNotFoundException
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 serviceUserNotFoundException
public GroupEntity getNestedGroup(String applicationName, String userName, String groupName, URI baseUri) throws MembershipNotFoundException, UserNotFoundException
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 foundUserNotFoundException
@Nullable public URI getAvatarForUser(String applicationName, String username, int sizeHint) throws UserNotFoundException, DirectoryNotFoundException, OperationFailedException
Copyright © 2017 Atlassian. All rights reserved.