com.atlassian.user
Interface UserManager

All Superinterfaces:
EntityManager

public interface UserManager
extends EntityManager


Method Summary
 void alterPassword(User user, java.lang.String plainTextPass)
          Encrypts the plain password, sets it on the user, and saves the user.
 User createUser(java.lang.String username)
          Deprecated. since 3.0 use createUser(User, Credential) because this is an inconvenient way to create users now that the setFullName() and setEmail() methods are no longer on the User interface
 User createUser(User userTemplate, Credential credential)
          Creates a new user with the provided user details and encrypted password.
 User getUser(java.lang.String username)
           
 Pager<java.lang.String> getUserNames()
           
 Pager<User> getUsers()
           
 boolean isReadOnly(User user)
           
 User onExternalUserRename(java.lang.String oldName, java.lang.String newName)
          Notifies the manager of a user rename done externally
 void removeUser(User user)
          Removes the specified user from the repository.
 User renameUser(User user, java.lang.String userName)
          Renames the user to the new name.
 User saveUser(User user)
          Persists any changes made to the user to the storage system used by this user manager.
 
Methods inherited from interface com.atlassian.user.EntityManager
getIdentifier, getRepository, isCreative
 

Method Detail

getUsers

Pager<User> getUsers()
                     throws EntityException
Returns:
a Pager holding all users being managed.
Throws:
EntityException

getUserNames

Pager<java.lang.String> getUserNames()
                                     throws EntityException
Returns:
a Pager holding the names of all users being managed.
Throws:
EntityException

getUser

User getUser(java.lang.String username)
             throws EntityException
Returns:
a null or a User if one could be found.
Throws:
EntityException

createUser

User createUser(java.lang.String username)
                throws EntityException
Deprecated. since 3.0 use createUser(User, Credential) because this is an inconvenient way to create users now that the setFullName() and setEmail() methods are no longer on the User interface

Creates a new user with the username provided. Returns the newly created user.

Returns:
a User object representing the new user.
Throws:
DuplicateEntityException - if a user with the username already exists.
java.lang.UnsupportedOperationException - - if EntityManager.isCreative() returns false.
EntityException

createUser

User createUser(User userTemplate,
                Credential credential)
                throws EntityException,
                       java.lang.UnsupportedOperationException,
                       java.lang.IllegalArgumentException
Creates a new user with the provided user details and encrypted password. Returns the newly created user.

Parameters:
userTemplate - the user template to use, which must have a non-null user name
credential - the user's password
Returns:
the newly created user, which should be used for subsequent operations on that user
Throws:
DuplicateEntityException - if a user with the same name already exists
RepositoryException - if there is a problem communicating with the underlying storage mechanism
java.lang.UnsupportedOperationException - if EntityManager.isCreative() returns false
java.lang.IllegalArgumentException - if the user, user name or credential is null
EntityException

alterPassword

void alterPassword(User user,
                   java.lang.String plainTextPass)
                   throws EntityException
Encrypts the plain password, sets it on the user, and saves the user. Implementations supporting this will usually have an internal PasswordEncryptor.

Throws:
java.lang.UnsupportedOperationException - - if EntityManager.isCreative() returns false.
EntityException

renameUser

User renameUser(User user,
                java.lang.String userName)
                throws EntityException
Renames the user to the new name.

Throws:
EntityException

onExternalUserRename

User onExternalUserRename(java.lang.String oldName,
                          java.lang.String newName)
                          throws EntityException
Notifies the manager of a user rename done externally

Throws:
EntityException

saveUser

User saveUser(User user)
              throws EntityException,
                     java.lang.IllegalArgumentException
Persists any changes made to the user to the storage system used by this user manager.

To ensure consistent behaviour across all repository types, clients must call this method after changing any properties on a User.

Returns:
the saved user, which may be a different object to the one passed in
Throws:
java.lang.UnsupportedOperationException - - if EntityManager.isCreative() returns false
java.lang.IllegalArgumentException - if the user is null or not managed by this repository
EntityException

removeUser

void removeUser(User user)
                throws EntityException,
                       java.lang.IllegalArgumentException
Removes the specified user from the repository.

Throws:
java.lang.UnsupportedOperationException - if isReadOnly(User) returns true.
java.lang.IllegalArgumentException - if the user is null or not managed by this repository
EntityException

isReadOnly

boolean isReadOnly(User user)
                   throws EntityException
Returns:
true indicates that information on the user object cannot be altered in the storage system (see RepositoryIdentifier), false indicates that the storage system will save changes or that this UserManager does not know about the User.
Throws:
EntityException


Copyright © 2005-2015 Atlassian. All Rights Reserved.