public interface UserDao
User
s, PasswordCredential
s and user attributes.Modifier and Type | Method and Description |
---|---|
User |
add(User user,
PasswordCredential credential)
Creates a new user with the given details and credentials.
|
BatchResult<User> |
addAll(Set<UserTemplateWithCredentialAndAttributes> users)
Bulk add of users using JDBC batch support.
|
TimestampedUser |
findByName(long directoryId,
String userName)
Finds and returns the user with the given name and directory ID.
|
UserWithAttributes |
findByNameWithAttributes(long directoryId,
String userName)
Finds and returns the user with attributes with the given name and directory ID.
|
PasswordCredential |
getCredential(long directoryId,
String userName)
Returns the credential for the given user.
|
List<PasswordCredential> |
getCredentialHistory(long directoryId,
String userName)
Returns the previous credentials for the given user, starting with the oldest.
|
void |
remove(User user)
Removes the user.
|
void |
removeAllUsers(long directoryId,
Set<String> userNames)
Remove all the given users from directory.
|
void |
removeAttribute(User user,
String attributeName)
Removes the attributes for the user with the given name.
|
User |
rename(User user,
String newName)
Changes the user's name to the provided new name.
|
<T> List<T> |
search(long directoryId,
EntityQuery<T> query)
Returns users matching the search query in the given directory, ordered by name.
|
void |
storeAttributes(User user,
Map<String,Set<String>> attributes)
Adds or updates a user's attributes with the new Map of attribute values.
|
User |
update(User user)
Updates all the user properties (except the username) of the user with the same directory and
case-insensitive name.
|
void |
updateCredential(User user,
PasswordCredential credential,
int maxCredentialHistory)
Updates the credential (password) of the user with the same directory and case-insensitive name.
|
TimestampedUser findByName(long directoryId, String userName) throws UserNotFoundException
UserNotFoundException
- if the user could not be foundUserWithAttributes findByNameWithAttributes(long directoryId, String userName) throws UserNotFoundException
UserNotFoundException
- if the user could not be foundPasswordCredential getCredential(long directoryId, String userName) throws UserNotFoundException
UserNotFoundException
- if the user could not be foundList<PasswordCredential> getCredentialHistory(long directoryId, String userName) throws UserNotFoundException
UserNotFoundException
- if the user could not be foundUser add(User user, PasswordCredential credential) throws UserAlreadyExistsException, IllegalArgumentException, DirectoryNotFoundException
user
- the user to createcredential
- the encrypted password for the user, which may be null if the user's password is not yet availableUserAlreadyExistsException
- if a user with the same directory and name (case-insensitive) already existsIllegalArgumentException
- if the user name, directory or any details are null, or if the credential is not encryptedDirectoryNotFoundException
void storeAttributes(User user, Map<String,Set<String>> attributes) throws UserNotFoundException
user
- the user to store attributes forattributes
- new or updated attributes (attributes that don't need changing should not appear in this Map).UserNotFoundException
- user with supplied username does not exist.User update(User user) throws UserNotFoundException, IllegalArgumentException
When the username itself changes then the rename(User, String)
method is called first, and this method
may be called afterwards if other details (eg email or display name) have also changed.
Even if the username is changed in case only (eg from "mary" to "Mary") then the rename() method will be called first. This implies that the implementation of this method should only need to change the cwd_user table.
user
- the user details, which should have the same name as the user to modifyUserNotFoundException
- if there is no user with the same name (case-insensitive) and directory as the
user providedIllegalArgumentException
- if the user name, directory or any details are nullrename(User, String)
void updateCredential(User user, PasswordCredential credential, int maxCredentialHistory) throws UserNotFoundException, IllegalArgumentException
user
- the user whose password will be modifiedUserNotFoundException
- if there is no user with the same name (case-insensitive) and directory as the user providedIllegalArgumentException
- if the credential is null or not encryptedUser rename(User user, String newName) throws UserNotFoundException, UserAlreadyExistsException, IllegalArgumentException
This method will be called for any change to a username including a case-only change (eg from "alice" to "Alice"). If there are changes to the username as well as to other user properties (eg email, display name) then callers must call the rename() method first followed by the update() method.
Implementations of this method will normally need to update the cwd_user table as well as cwd_membership, whereas the update() method implies a change to only the cwd_user table.
user
- the user to renamenewName
- the new name of the userUserNotFoundException
- if the user cannot be foundUserAlreadyExistsException
- if the new name is already used by a different userIllegalArgumentException
- if the new name is nullupdate(User)
void removeAttribute(User user, String attributeName) throws UserNotFoundException
user
- the user whose attribute will be removedattributeName
- the name of the attribute to be removedUserNotFoundException
- if the user cannot be foundvoid remove(User user) throws UserNotFoundException
user
- the user to removeUserNotFoundException
- if the user does not exist<T> List<T> search(long directoryId, EntityQuery<T> query)
BatchResult<User> addAll(Set<UserTemplateWithCredentialAndAttributes> users)
users
- to be addedCopyright © 2013 Atlassian. All Rights Reserved.