MotechUserService¶
-
public interface
MotechUserService
¶ Service interface that defines APIs to retrieve and manage user details
Methods¶
activateUser¶
changeEmail¶
changeExpiredPassword¶
-
MotechUserProfile
changeExpiredPassword
(String userName, String oldPassword, String newPassword)¶ Changes password of user with given username when user status is ‘MUST_CHANGE_PASSWORD’ and return his
org.motechproject.security.domain.MotechUserProfile
. The new password and the old password cannot be the same. Blocks user after crossing the failure login counter.Parameters: - userName – of user
- oldPassword – password that was used before
- newPassword – new password for user
Throws: - org.springframework.security.authentication.LockedException – when user has been blocked
Returns: user profile after password change
changePassword¶
-
MotechUserProfile
changePassword
(String oldPassword, String newPassword)¶ Allows to change a password of a currently logged-in user.
Parameters: - oldPassword – An old password of currently logged user
- newPassword – A new password for the currently logged user
Returns: MotechUserProfile with updated user information
changePassword¶
-
MotechUserProfile
changePassword
(String userName, String oldPassword, String newPassword)¶ Changes password of user with given username and return his
org.motechproject.security.domain.MotechUserProfile
Parameters: - userName – of user
- oldPassword – password that was used before
- newPassword – new password for user
Returns: user profile after password change
getCurrentUser¶
getLocale¶
-
Locale
getLocale
(String userName)¶ Returns
java.util.Locale
of user with given nameParameters: - userName – of user
Returns: locale of user
getOpenIdUsers¶
-
List<MotechUserProfile>
getOpenIdUsers
()¶ Returns
org.motechproject.security.domain.MotechUserProfile
of users with set OpenIdReturns: list that contains users with OpenId
getRoles¶
getUser¶
getUserByEmail¶
getUsers¶
-
List<MotechUserProfile>
getUsers
()¶ Returns
org.motechproject.security.domain.MotechUserProfile
of all users.Returns: list that contains profiles of all users
hasActiveMotechAdmin¶
-
boolean
hasActiveMotechAdmin
()¶ Checks if there active user with Admin role
Returns: true if user exists, otherwise false
hasEmail¶
hasUser¶
register¶
-
void
register
(String username, String password, String email, String externalId, List<String> roles, Locale locale)¶ Registers new user
Parameters: - username – of new user
- password – of new user
- email – of new user
- externalId – of new user
- roles – list that contains roles for new user
- locale – to be set as default for new user
register¶
-
void
register
(String username, String password, String email, String externalId, List<String> roles, Locale locale, UserStatus userStatus, String openId)¶ Registers new user
Parameters: - username – of new user
- password – of new user
- email – of new user
- externalId – of new user
- roles – list that contains roles for new user
- locale – to be set as default for new user
- userStatus – user status,
org.motechproject.security.domain.UserStatus
- openId – of new user
registerMotechAdmin¶
-
void
registerMotechAdmin
(String username, String password, String email, Locale locale)¶ A method that allows to register the first MOTECH Admin in the application. Throws
java.lang.IllegalStateException
when an active Admin User is already registered.Parameters: - username – Username of a new user
- password – Password of a new user
- email – Email address of a new user
- locale – Selected locale for the new user
retrieveUserByCredentials¶
-
MotechUserProfile
retrieveUserByCredentials
(String username, String password)¶ Returns
org.motechproject.security.domain.MotechUserProfile
for user with given username and passwordParameters: - username – of user to be returned
- password – of user to be returned
Returns: profile of user with given credentials
sendLoginInformation¶
-
void
sendLoginInformation
(String userName)¶ Sends login information by email using address set for user with given name
Parameters: - userName – name of user
Throws: - UserNotFoundException – when user has not been found
- NonAdminUserException – when user is not an admin
setLocale¶
-
void
setLocale
(Locale locale)¶ Sets
org.motechproject.security.domain.MotechUserProfile
for user in current sessionParameters: - locale – to be set for user
updateUserDetailsWithPassword¶
updateUserDetailsWithoutPassword¶
validatePassword¶
-
void
validatePassword
(String password)¶ Checks whether the password meets requirements
Parameters: - password – the password to validate
Throws: - PasswordValidatorException – when password is not valid