001: /*
002: Copyright (c) 2003 eInnovation Inc. All rights reserved
003:
004: This library is free software; you can redistribute it and/or modify it under the terms
005: of the GNU Lesser General Public License as published by the Free Software Foundation;
006: either version 2.1 of the License, or (at your option) any later version.
007:
008: This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
009: without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
010: See the GNU Lesser General Public License for more details.
011: */
012:
013: package com.openedit.users;
014:
015: import java.util.Collection;
016: import java.util.List;
017: import java.util.Map;
018:
019: import com.openedit.OpenEditException;
020: import com.openedit.hittracker.HitTracker;
021: import com.openedit.users.filesystem.PermissionsManager;
022: import com.openedit.util.StringEncryption;
023:
024: /**
025: * This interface allows the caller to retrieve users.
026: *
027: * @author Eric and Matt
028: */
029: public interface UserManager {
030: /**
031: * Retrieve the list of permissions that may be assigned to groups.
032: *
033: * @return A list of {@link Permission}s
034: * @throws UserManagerException
035: */
036: List getPermissions() throws UserManagerException;
037:
038: List getSystemPermissionGroups();
039:
040: /**
041: * Retrieve the group with the given name.
042: *
043: * @param inGroupName The group name
044: *
045: * @return The group, or <code>null</code> if there is no such group
046: *
047: * @throws UserManagerException If something went wrong trying to retrieve the group
048: */
049: Group getGroup(String inGroupName) throws UserManagerException;
050:
051: /**
052: * Get all the groups managed by this user manager.
053: *
054: * @return A collection of {@link Group}s
055: *
056: * @throws UserManagerException If the list of groups could not be retrieved
057: */
058: Collection getGroups();
059:
060: /**
061: * Retrieve the user with the given username.
062: *
063: * @param inUserName The username
064: *
065: * @return The user, or <code>null</code> if there is no such user
066: *
067: * @throws UserManagerException If something went wrong trying to retrieve the user
068: */
069: User getUser(String inUserName) throws UserManagerException;
070:
071: /**
072: * Get all the users managed by this user manager.
073: *
074: * @return A collection of {@link User}s
075: *
076: * @throws UserManagerException If the list of users could not be retrieved
077: */
078: HitTracker getUsers();
079:
080: /**
081: * Authenticate the given user.
082: *
083: * @param inUser The user to authenticate
084: *
085: * @return <code>true</code> if the user was authenticated successfully, <code>false</code> if
086: * not
087: *
088: * @throws UserManagerException If something went wrong trying to authenticate the user
089: */
090: boolean authenticate(User inUser, String inPassword)
091: throws UserManagerException;
092:
093: /**
094: * Create a new group with the given name.
095: *
096: * @param inGroupName The new group's name
097: *
098: * @return The new group
099: *
100: * @throws DuplicateGroupException If there is already a group with the given name
101: * @throws UserManagerException If the group could not be created for some reason
102: */
103: Group createGroup(String inGroupName) throws UserManagerException;
104:
105: /**
106: * Create a user with the given username and password.
107: *
108: * @param inUserName The new user's username
109: * @param inPassword The new user's password
110: *
111: * @return The new user
112: *
113: * @throws DuplicateUserException If there is already a user with the given username
114: * @throws UserManagerException If the user could not be created for some reason
115: */
116: User createUser(String inUserName, String inPassword)
117: throws UserManagerException;
118:
119: /**
120: * Delete the given group.
121: *
122: * @param inGroup The group to delete
123: *
124: * @throws UserManagerException If the group could not be deleted
125: */
126: void deleteGroup(Group inGroup) throws UserManagerException;
127:
128: /**
129: * Delete the given user.
130: *
131: * @param inUser The user to delete
132: *
133: * @throws UserManagerException If the user could not be deleted
134: */
135: void deleteUser(User inUser) throws UserManagerException;
136:
137: /**
138: * Delete the given groups.
139: *
140: * @param inGroups The groups to delete
141: *
142: * @throws UserManagerException If the groups could not be deleted
143: */
144: public void deleteGroups(List inGroups) throws UserManagerException;
145:
146: /**
147: * Delete the given users.
148: *
149: * @param inUsers The users to delete
150: *
151: * @throws UserManagerException If the users could not be deleted
152: */
153: public void deleteUsers(List inUsers) throws UserManagerException;
154:
155: /**
156: * @param emailaddress
157: * @return
158: */
159: public User getUserByEmail(String emailaddress)
160: throws UserManagerException;
161:
162: /**
163: * Pass in a Lucene query and find users
164: * @param inQuery
165: * @return
166: * @throws UserManagerException
167: */
168: public HitTracker findUser(String inQuery)
169: throws UserManagerException;
170:
171: /**
172: * Saves the given user to persistent storage.
173: *
174: * @param inUser The user to save
175: */
176: void saveUser(User inUser);
177:
178: /**
179: * Saves the given group to persistent storage.
180: *
181: * @param inGroup The group to save
182: */
183: void saveGroup(Group inGroup);
184:
185: HitTracker getUsersInGroup(Group inGroup);
186:
187: HitTracker getUsersInGroup(String inString);
188:
189: void setAuthenticator(Authenticator inAuthen);
190:
191: Authenticator getAuthenticator();
192:
193: StringEncryption getStringEncryption();
194:
195: public String decryptPassword(User inUser) throws OpenEditException;
196:
197: public Map getUserListeners();
198:
199: public void addUserListener(UserListener inListener);
200:
201: public void logout(User inUser);
202:
203: public PermissionsManager getPermissionsManager();
204:
205: User createGuestUser(String inAccount, String inPassword,
206: String inGroupname);
207:
208: }
|