View Javadoc

1   package com.atlassian.user;
2   
3   import com.atlassian.user.search.page.Pager;
4   import com.atlassian.user.security.password.PasswordEncryptor;
5   
6   public interface UserManager extends EntityManager
7   {
8       /**
9        * @return a {@link Pager} holding all users being managed.
10       * @throws EntityException
11       */
12      Pager getUsers()  throws EntityException;
13  
14      /**
15       * @return a {@link Pager} holding the names of all users being managed.
16       * @throws EntityException
17       */
18      Pager getUserNames() throws EntityException;
19  
20      /**
21       * @return - a <code>null</code> or a {@link User} if one could be found.
22       *
23       * @throws EntityException - representing a system error.
24       */
25      User getUser(String username) throws EntityException;
26  
27      /**
28       * @return a {@link User} object.
29       *
30       * @throws EntityException - representing a system error
31       * @throws UnsupportedOperationException - if {@link UserManager#isCreative()} returns <code>false</code>.
32       */
33      User createUser(String username) throws EntityException;
34  
35  
36      /**
37       * Encrypts the plain password, sets it on the user, and saves the user.
38       * Implementations supporting this will usually have an internal {@link PasswordEncryptor}.
39       *
40       * @throws EntityException - representing a system error.
41       * @throws UnsupportedOperationException - if {@link UserManager#isCreative()} returns <code>false</code>.
42       */
43      void alterPassword(User user, String plainTextPass) throws EntityException;
44  
45      /**
46       * @throws EntityException - representing a system error.
47       * @throws UnsupportedOperationException - if {@link UserManager#isCreative()} returns <code>false</code>.
48       */
49      void saveUser(User user) throws EntityException;
50  
51      /**
52       * @throws EntityException - representing a system error.
53       * @throws UnsupportedOperationException - if {@link UserManager#isReadOnly(User)} returns <code>true</code>.
54       */
55      void removeUser(User user) throws EntityException;
56  
57      /**
58       * @return true indicates that information on the user object cannot be altered in the storage system
59       * (see {@link com.atlassian.user.repository.RepositoryIdentifier}),
60       * false indicates that the storage system will save changes or that this {@link UserManager} does not 
61       * know about the {@link User}.
62       */
63      boolean isReadOnly(User user) throws EntityException;
64  }
65