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 Details

  • Method Details

    • getCurrentUser

      User getCurrentUser()
      Gets the currently logged in user.
      Returns:
      the currently logged in user
    • isCurrentUserAlias

      default boolean isCurrentUserAlias(String userId)
      Returns true if the specified user ID is the alias for the current user.
      Parameters:
      userId - the userId as returned by User.getId()
      Returns:
      true if alias, false otherwise
    • isCurrentUser

      default boolean isCurrentUser(String userId)
      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

      default void checkForCurrentUser(String userId)
      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

      User getUser(String userId)
      Gets a user with unique user ID.
      Parameters:
      userId - the UserId
      Returns:
      the user ID
    • getUsers

      Pagination<User> getUsers(int offset, int count)
      Gets a list of users the current user can see.
      Parameters:
      offset - the offset
      count - the count
      Returns:
      the PaginatedEntry of users
    • getUsers

      Pagination<User> getUsers(int offset, int count, String search)
      Gets a list of users the current user can see.
      Parameters:
      offset - the offset
      count - the count
      search - the search query
      Returns:
      the PaginatedEntry of users
    • createUser

      UserCreateResponse createUser(UserCreateRequest userCreateRequest)
      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

      User updateUser(String userId, UserUpdateRequest userUpdateRequest)
      Updates a user, preserving the user's password.
      Parameters:
      userId - the user ID to update
      userUpdateRequest - the user to update
      Returns:
      the User, as it was updated
    • updateUserPassword

      SessionCreation updateUserPassword(String userId, UserUpdatePasswordRequest userUpdatePasswordRequest)
      Updates the User's password given the UserUpdatePasswordRequest and the user ID.
      Parameters:
      userId - the user ID to update
      userUpdatePasswordRequest - the UserUpdatePasswordRequest instance
      Returns:
      a SessionCreation indicating new session key
    • deleteUser

      void deleteUser(String userId)
      Removes a user from the system, effectively deleting his/her account.
      Parameters:
      userId - the userId