001: /*
002: * Copyright 2004 Outerthought bvba and Schaubroeck nv
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package org.outerj.daisy.repository.user;
017:
018: import org.outerj.daisy.repository.RepositoryException;
019:
020: /**
021: * Manager for all things user related.
022: *
023: * <p>The UserManager can be retrieved via {@link org.outerj.daisy.repository.Repository#getUserManager()}.
024: *
025: */
026: public interface UserManager {
027: /**
028: * Returns all available users. Only Administrators can do this.
029: */
030: Users getUsers() throws RepositoryException;
031:
032: long[] getUserIds() throws RepositoryException;
033:
034: /**
035: * Returns the publicly available information for a user.
036: */
037: PublicUserInfo getPublicUserInfo(long userId)
038: throws RepositoryException;
039:
040: /**
041: * Returns the publicly available information for a user.
042: */
043: PublicUserInfo getPublicUserInfo(String login)
044: throws RepositoryException;
045:
046: /**
047: * Returns the public information of all users. Contrary to
048: * {@link #getUsers()}, this method can be called by any user.
049: */
050: PublicUserInfos getPublicUserInfos() throws RepositoryException;
051:
052: /**
053: * Returns all available roles.
054: */
055: Roles getRoles() throws RepositoryException;
056:
057: /**
058: * Creates a new User.
059: *
060: * <p>The persistency of this object towards the data store
061: * is the responsibility of the client using the User
062: * object itself by calling the {@link User#save()} method.
063:
064: * @param login the user login used when authenticating
065: * @return a User object which isn't persistent yet.
066: */
067: User createUser(String login);
068:
069: /**
070: * Deletes the User with data store id userId
071: * @param userId data store id of the User to delete
072: */
073: void deleteUser(long userId) throws RepositoryException;
074:
075: /**
076: * Return the User object which is identified by data store id userId.
077: *
078: * <p>Only administrators can retrieve the User object for users that are
079: * not themselve.
080: *
081: * @param userId the data store id of the desired User object
082: * @return the User object corresponding to data store id userId
083: */
084: User getUser(long userId, boolean updateable)
085: throws RepositoryException;
086:
087: /**
088: * Return the Role object which is identified by data store id roleId
089: * @param roleId the data store id of the desired Role object
090: * @return the Role object corresponding to data store id roleId
091: */
092: Role getRole(long roleId, boolean updateable)
093: throws RepositoryException;
094:
095: /**
096: * Return the User object which is identified by the specified userLogin
097: * @param userLogin the login by which the desired User object is identified
098: * @return the User object for the user with login userLogin
099: */
100: User getUser(String userLogin, boolean updateable)
101: throws RepositoryException;
102:
103: /**
104: * Return the Role object which is identified by the specified roleName
105: * @param roleName the name by which the desired Role object is identified
106: * @return the Role object for the role with name roleName
107: */
108: Role getRole(String roleName, boolean updateable)
109: throws RepositoryException;
110:
111: /**
112: * Creates a new Role.
113: *
114: * @param roleName
115: * @return a Role object
116: */
117: Role createRole(String roleName);
118:
119: /**
120: * Deletes the Role with data store id roleId
121: * @param roleId data store id of the Role to delete
122: */
123: void deleteRole(long roleId) throws RepositoryException;
124:
125: /**
126: * Retrieves the display name of a user, using the user cache for quick access.
127: * Only administrators are allowed to access the full user object, so this method
128: * enables 'normal' users to resolve user ids to names.
129: *
130: * <p>This is the same as otherwise retrieved from {@link User#getDisplayName()}.
131: *
132: * @throws UserNotFoundException if the user doesn't exist
133: */
134: String getUserDisplayName(long userId) throws RepositoryException;
135:
136: /**
137: * Retrieves the login of a user.
138: * Only administrators are allowed to access the full user object, so this method
139: * enables 'normal' users to resolve user ids to logins.
140: *
141: * <p>This is the same as otherwise retrieved from {@link User#getLogin()}.
142: *
143: * @throws UserNotFoundException if the user doesn't exist
144: */
145: String getUserLogin(long userId) throws RepositoryException;
146:
147: /**
148: * Retrieves the id of a user based on its login. This method can be used
149: * instead of getUser(login).getId() for non-administrator users.
150: *
151: * @throws UserNotFoundException if the user doesn't exist
152: */
153: long getUserId(String login) throws RepositoryException;
154:
155: /**
156: * Retrieves the name of a role, using the user cache for quick access.
157: *
158: * <p>This is the same as otherwise retrieved from {@link Role#getName()}.
159: *
160: * @throws RoleNotFoundException if the role doesn't exist
161: */
162: String getRoleDisplayName(long roleId) throws RepositoryException;
163:
164: Users getUsersByEmail(String email) throws RepositoryException;
165:
166: AuthenticationSchemeInfos getAuthenticationSchemes()
167: throws RepositoryException;
168: }
|