Package org.duracloud.account.db.util
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 Summary
Modifier and TypeMethodDescriptionbooleanaddUserToAccount(Long acctId, Long userId) This method sets the roles of a user in an account.voidchangePassword(Long userId, String oldPassword, boolean oldPasswordEncoded, String newPassword) This method changes the password of the user with the arg userId from the oldPassword to the newPassword.voidchangePasswordInternal(Long userId, String oldPassword, boolean oldPasswordEncoded, String newPassword) voidcheckUsername(String username) This method throws an exception is the username is non-unique or it is not a valid username.org.duracloud.account.db.model.DuracloudUsercreateNewUser(String username, String password, String firstName, String lastName, String email, String securityQuestion, String securityAnswer) This method creates and persists a new user.voidforgotPassword(String username, String securityQuestion, String securityAnswer) 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.org.duracloud.account.db.model.DuracloudUserloadDuracloudUserByIdInternal(Long userId) org.duracloud.account.db.model.DuracloudUserloadDuracloudUserByUsername(String username) This method loads a DuracloudUser from the persistence layer and populate its rights info.org.duracloud.account.db.model.DuracloudUserloadDuracloudUserByUsernameInternal(String username) redeemAccountInvitation(Long userId, String redemptionCode) This method redeems an invitation to add this user to a DuraCloud account.voidredeemPasswordChangeRequest(Long userId, String redemptionCode) org.duracloud.account.db.model.UserInvitationretrievePassordChangeInvitation(String redemptionCode) Returns a user password change invitationvoidrevokeUserRights(Long acctId, Long userId) This method removes all rights to an account for a given user.booleansetUserRights(Long acctId, Long userId, org.duracloud.account.db.model.Role... roles) This method sets the roles of a user in an account.voidstoreUserDetails(Long userId, String firstName, String lastName, String email, String securityQuestion, String securityAnswer, String allowableIPAddressRange) This method persists the arg user details.
-
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:
InvalidUsernameExceptionUserAlreadyExistsException
-
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 userpassword- of new userfirstName- of new userlastName- of new useremail- of new usersecurityQuestion- of new usersecurityAnswer- of new user- Returns:
- DuracloudUser
- Throws:
UserAlreadyExistsExceptionInvalidUsernameException
-
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
This method removes all rights to an account for a given user.- Parameters:
acctId- on which rights will be revokeduserId- 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 changeoldPassword-oldPasswordEncoded- flag noting if the password is hashednewPassword-- Throws:
InvalidPasswordExceptionDBNotFoundException
-
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:
InvalidPasswordExceptionDBNotFoundException
-
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 passwordsecurityQuestion- of user who forgot their passwordsecurityAnswer- of user who forgot their password- Throws:
InvalidPasswordExceptionUnsentEmailExceptionDBNotFoundException
-
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 invitationredemptionCode- 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 userfirstName- of userlastName- of useremail- of usersecurityQuestion- of usersecurityAnswer- of userallowableIPAddressRange-- Throws:
DBNotFoundException
-