Interface UserService
- All Known Implementing Classes:
AbstractUserService
,AnonUserService
,SuperuserUserService
,UserUserService
public interface UserService
Service to access Users in the system.
Created by patricktwohig on 3/19/15.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault void
checkForCurrentUser
(String userId) Given the userId, which may be either username or email address, will check for the current user.createUser
(UserCreateRequest userCreateRequest) Creates a new user.void
deleteUser
(String userId) Removes a user from the system, effectively deleting his/her account.Gets the currently logged in user.Gets a user with unique user ID.getUsers
(int offset, int count) Gets a list of users the current user can see.Gets a list of users the current user can see.default boolean
isCurrentUser
(String userId) Given the userId, which may be either username, email address, or "me" this will check for the current user.default boolean
isCurrentUserAlias
(String userId) Returns true if the specified user ID is the alias for the current user.updateUser
(String userId, UserUpdateRequest userUpdateRequest) Updates a user, preserving the user's password.updateUserPassword
(String userId, UserUpdatePasswordRequest userUpdatePasswordRequest) Updates the User's password given theUserUpdatePasswordRequest
and the user ID.
-
Field Details
-
CURRENT_USER_ALIAS
- See Also:
-
-
Method Details
-
getCurrentUser
User getCurrentUser()Gets the currently logged in user.- Returns:
- the currently logged in user
-
isCurrentUserAlias
Returns true if the specified user ID is the alias for the current user.- Parameters:
userId
- the userId as returned byUser.getId()
- Returns:
- true if alias, false otherwise
-
isCurrentUser
Given the userId, which may be either username, email address, or "me" this will check for the current user.- Parameters:
userId
- the userId, which could be either email, name, "me", or null- Returns:
- true if matches current user, false otherwise
-
checkForCurrentUser
Given the userId, which may be either username or email address, will check for the current user. If the current user does not match, then this throws an exception to indicate that the current user does not match.- Parameters:
userId
- the userId, which could be either email or name- Throws:
NotFoundException
- if the current user does not match
-
getUser
Gets a user with unique user ID.- Parameters:
userId
- the UserId- Returns:
- the user ID
-
getUsers
Gets a list of users the current user can see.- Parameters:
offset
- the offsetcount
- the count- Returns:
- the PaginatedEntry of users
-
getUsers
Gets a list of users the current user can see.- Parameters:
offset
- the offsetcount
- the countsearch
- the search query- Returns:
- the PaginatedEntry of users
-
createUser
Creates a new user. The service may override or reject the request based on the current user access level.- Parameters:
userCreateRequest
- the user to create- Returns:
- the User, as it was created by the database
-
updateUser
Updates a user, preserving the user's password.- Parameters:
userId
- the user ID to updateuserUpdateRequest
- the user to update- Returns:
- the User, as it was updated
-
updateUserPassword
SessionCreation updateUserPassword(String userId, UserUpdatePasswordRequest userUpdatePasswordRequest) Updates the User's password given theUserUpdatePasswordRequest
and the user ID.- Parameters:
userId
- the user ID to updateuserUpdatePasswordRequest
- theUserUpdatePasswordRequest
instance- Returns:
- a
SessionCreation
indicating new session key
-
deleteUser
Removes a user from the system, effectively deleting his/her account.- Parameters:
userId
- the userId
-