Interface DuracloudUserService

All Known Implementing Classes:
DuracloudUserServiceImpl

public interface DuracloudUserService
This interface defines the contract for loading, storing, and managing DuracloudUser entities.
Author:
Andrew Woods Date: Oct 8, 2010
  • Method Details

    • checkUsername

      @Secured("role:ROLE_ANONYMOUS, scope:ANY") void checkUsername(String username) throws InvalidUsernameException, UserAlreadyExistsException
      This method throws an exception is the username is non-unique or it is not a valid username.
      Parameters:
      username - sought
      Throws:
      InvalidUsernameException
      UserAlreadyExistsException
    • createNewUser

      @Secured("role:ROLE_ANONYMOUS, scope:ANY") org.duracloud.account.db.model.DuracloudUser createNewUser(String username, String password, String firstName, String lastName, String email, String securityQuestion, String securityAnswer) throws UserAlreadyExistsException, InvalidUsernameException
      This method creates and persists a new user.
      Parameters:
      username - of new user
      password - of new user
      firstName - of new user
      lastName - of new user
      email - of new user
      securityQuestion - of new user
      securityAnswer - of new user
      Returns:
      DuracloudUser
      Throws:
      UserAlreadyExistsException
      InvalidUsernameException
    • setUserRights

      @Secured("role:ROLE_ADMIN, scope:SELF_ACCT_PEER_UPDATE") boolean setUserRights(Long acctId, Long userId, org.duracloud.account.db.model.Role... roles)
      This method sets the roles of a user in an account.

      Note that this method only sets a user to new roles. To remove a user from an account, use revokeAllRights().

      Returns:
      true if an update was performed.
    • addUserToAccount

      @Secured("role:ROLE_ADMIN, scope:SELF_ACCT") boolean addUserToAccount(Long acctId, Long userId) throws DBNotFoundException
      This method sets the roles of a user in an account.

      Note that this method only sets a user to new roles. To remove a user from an account, use revokeAllRights().

      Returns:
      true if an update was performed.
      Throws:
      DBNotFoundException
    • revokeUserRights

      @Secured("role:ROLE_ADMIN, scope:SELF_ACCT_PEER") void revokeUserRights(Long acctId, Long userId)
      This method removes all rights to an account for a given user.
      Parameters:
      acctId - on which rights will be revoked
      userId - of user whose rights will be revoked
    • changePassword

      @Secured("role:ROLE_USER, scope:SELF_ID") void changePassword(Long userId, String oldPassword, boolean oldPasswordEncoded, String newPassword) throws DBNotFoundException, InvalidPasswordException
      This method changes the password of the user with the arg userId from the oldPassword to the newPassword.
      Parameters:
      userId - of user who is seeking a password change
      oldPassword -
      oldPasswordEncoded - flag noting if the password is hashed
      newPassword -
      Throws:
      InvalidPasswordException
      DBNotFoundException
    • changePasswordInternal

      @Secured("role:ROLE_ANONYMOUS, scope:ANY") void changePasswordInternal(Long userId, String oldPassword, boolean oldPasswordEncoded, String newPassword) throws DBNotFoundException, InvalidPasswordException
      Parameters:
      userId -
      oldPassword -
      oldPasswordEncoded -
      newPassword -
      Throws:
      InvalidPasswordException
      DBNotFoundException
    • forgotPassword

      @Secured("role:ROLE_ANONYMOUS, scope:ANY") void forgotPassword(String username, String securityQuestion, String securityAnswer) throws DBNotFoundException, InvalidPasswordException, UnsentEmailException
      This method generates a random password, replaces the existing password with the randomly generated one, and sends an email to the address on file for the given username.
      Parameters:
      username - of user who forgot their password
      securityQuestion - of user who forgot their password
      securityAnswer - of user who forgot their password
      Throws:
      InvalidPasswordException
      UnsentEmailException
      DBNotFoundException
    • retrievePassordChangeInvitation

      @Secured("role:ROLE_ANONYMOUS, scope:ANY") org.duracloud.account.db.model.UserInvitation retrievePassordChangeInvitation(String redemptionCode) throws DBNotFoundException
      Returns a user password change invitation
      Parameters:
      redemptionCode -
      Returns:
      Throws:
      DBNotFoundException
    • loadDuracloudUserByUsername

      @Secured("role:ROLE_USER, scope:SELF_NAME") org.duracloud.account.db.model.DuracloudUser loadDuracloudUserByUsername(String username) throws DBNotFoundException
      This method loads a DuracloudUser from the persistence layer and populate its rights info.
      Parameters:
      username - of user to load
      Returns:
      DuracloudUser
      Throws:
      DBNotFoundException
    • loadDuracloudUserByUsernameInternal

      @Secured("role:ROLE_ANONYMOUS, scope:ANY") org.duracloud.account.db.model.DuracloudUser loadDuracloudUserByUsernameInternal(String username) throws DBNotFoundException
      Throws:
      DBNotFoundException
    • loadDuracloudUserByIdInternal

      @Secured("role:ROLE_USER, scope:ANY") org.duracloud.account.db.model.DuracloudUser loadDuracloudUserByIdInternal(Long userId) throws DBNotFoundException
      Throws:
      DBNotFoundException
    • redeemAccountInvitation

      @Secured("role:ROLE_USER, scope:SELF_ID") Long redeemAccountInvitation(Long userId, String redemptionCode) throws InvalidRedemptionCodeException
      This method redeems an invitation to add this user to a DuraCloud account.
      Parameters:
      userId - the id of the user which will be added to the account indicated in the invitation
      redemptionCode - code which was sent to the user as part of the invitation to become part of an account
      Returns:
      the account id associated with the newly redeemed invitation.
      Throws:
      InvalidRedemptionCodeException
    • redeemPasswordChangeRequest

      @Secured("role:ROLE_ANONYMOUS, scope:ANY") void redeemPasswordChangeRequest(Long userId, String redemptionCode) throws InvalidRedemptionCodeException
      Throws:
      InvalidRedemptionCodeException
    • storeUserDetails

      @Secured("role:ROLE_USER, scope:SELF_ID") void storeUserDetails(Long userId, String firstName, String lastName, String email, String securityQuestion, String securityAnswer, String allowableIPAddressRange) throws DBNotFoundException
      This method persists the arg user details.
      Parameters:
      userId - of user
      firstName - of user
      lastName - of user
      email - of user
      securityQuestion - of user
      securityAnswer - of user
      allowableIPAddressRange -
      Throws:
      DBNotFoundException