Interface UserManager
- All Known Implementing Classes:
FileUserManager
public interface UserManager
The main interface for managing user details.
- Since:
- 7.0.1
- Author:
- Moran Avigdor
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidcreateUser(UserDetails userDetails) Create a new user with the specifieduserDetails.voiddeleteUser(String username) Delete an existing user represented by the specifiedusername.Retrieve the user details byusername.booleanIndicates that this manager is for read-only purposes, and that any invocation of a destructive operation will throw anAccessDeniedException.mapUsers()Returns a map containing mapping between username and user-details.voidupdateUser(UserDetails userDetails) Updates the user details, excluding the username which must remain the same.booleanuserExists(String username) Queries for presence of a user by username.
-
Method Details
-
isReadOnly
boolean isReadOnly()Indicates that this manager is for read-only purposes, and that any invocation of a destructive operation will throw anAccessDeniedException.- Returns:
trueif read-only access is allowed.
-
createUser
void createUser(UserDetails userDetails) throws UserAlreadyExistsException, UserDataAccessException, AccessDeniedException Create a new user with the specifieduserDetails.- Parameters:
userDetails- new user details to store.- Throws:
UserAlreadyExistsException- if the user details represent a non-unique userUserDataAccessException- if could not store the specified user details.AccessDeniedException- if read-only access is allowed.
-
deleteUser
void deleteUser(String username) throws UserNotFoundException, UserDataAccessException, AccessDeniedException Delete an existing user represented by the specifiedusername.- Parameters:
username- an existing user name.- Throws:
UserNotFoundException- if the user was not found.UserDataAccessException- if could not delete the specified user details.AccessDeniedException- if read-only access is allowed.
-
getUser
Retrieve the user details byusername.- Parameters:
username- an existing user to retrieve.- Returns:
- the user details of the specified user.
- Throws:
UserNotFoundException- if the user was not found.UserDataAccessException- if could not retrieve the specified user details.
-
mapUsers
Returns a map containing mapping between username and user-details.- Returns:
- a mapping between username and user-details.
- Throws:
UserDataAccessException- if could not retrieve user-details to map.
-
updateUser
void updateUser(UserDetails userDetails) throws UserNotFoundException, UserDataAccessException, AccessDeniedException Updates the user details, excluding the username which must remain the same. In order to update a username, a user must be removed and re-created. A password on the other hand, may require encryption, only if it was modified.- Parameters:
userDetails- the user details to update.- Throws:
UserNotFoundException- if the user was not found.UserDataAccessException- if could not update the user details.AccessDeniedException- if read-only access is allowed.
-
userExists
Queries for presence of a user by username.- Parameters:
username- the user to check existence for.- Returns:
trueif the user exists;falseotherwise.- Throws:
UserDataAccessException- if could not query for the specified user.
-