Class UIUsersService
- java.lang.Object
-
- ca.corefacility.bioinformatics.irida.ria.web.services.UIUsersService
-
@Component public class UIUsersService extends java.lang.Object
Handles service call for the administration of the IRIDA users.
-
-
Constructor Summary
Constructors Constructor Description UIUsersService(UserService userService, EmailController emailController, org.springframework.context.MessageSource messageSource, org.springframework.security.crypto.password.PasswordEncoder passwordEncoder, PasswordResetService passwordResetService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AjaxSuccessResponse
adminNewPasswordReset(java.lang.Long userId, java.security.Principal principal, java.util.Locale locale)
Create a newPasswordReset
for the givenUser
AjaxSuccessResponse
changeUserPassword(java.lang.Long userId, java.lang.String oldPassword, java.lang.String newPassword, java.security.Principal principal, javax.servlet.http.HttpServletRequest request, java.util.Locale locale)
Change the password of a userAjaxCreateItemSuccessResponse
createUser(UserCreateRequest userCreateRequest, java.security.Principal principal, java.util.Locale locale)
Submit a new userUserDetailsResponse
getUser(java.lang.Long userId, java.security.Principal principal)
Get the details for a specific userTableResponse<UserDetailsModel>
getUsersPagedList(AdminUsersTableRequest request)
Get a paged listing of users for the administration user.AjaxSuccessResponse
updateUser(java.lang.Long userId, UserEditRequest userEditRequest, java.security.Principal principal, javax.servlet.http.HttpServletRequest request, java.util.Locale locale)
Submit a user editAjaxSuccessResponse
updateUserStatus(java.lang.Long id, boolean isEnabled, java.util.Locale locale)
Update a user status (if the user is enabled within IRIDA).
-
-
-
Constructor Detail
-
UIUsersService
@Autowired public UIUsersService(UserService userService, EmailController emailController, org.springframework.context.MessageSource messageSource, org.springframework.security.crypto.password.PasswordEncoder passwordEncoder, PasswordResetService passwordResetService)
-
-
Method Detail
-
getUsersPagedList
public TableResponse<UserDetailsModel> getUsersPagedList(AdminUsersTableRequest request)
Get a paged listing of users for the administration user. This can be filtered and sorted.- Parameters:
request
- - the information about the current page of users to return- Returns:
TableResponse
-
createUser
public AjaxCreateItemSuccessResponse createUser(UserCreateRequest userCreateRequest, java.security.Principal principal, java.util.Locale locale) throws UIEmailSendException, UIUserFormException
Submit a new user- Parameters:
userCreateRequest
- aUserCreateRequest
containing details about a specific userprincipal
- a reference to the logged in userlocale
- The logged in user's request locale- Returns:
- The id of the new user
- Throws:
UIEmailSendException
- if there is an error emailing the password resetUIUserFormException
- if there are errors creating the new user
-
updateUserStatus
public AjaxSuccessResponse updateUserStatus(java.lang.Long id, boolean isEnabled, java.util.Locale locale) throws UIUserStatusException
Update a user status (if the user is enabled within IRIDA).- Parameters:
id
- - identifier for anUser
isEnabled
- - whether the user should be enabled.locale
- - usersLocale
- Returns:
- a success message
- Throws:
UIUserStatusException
- if there is an error updating the user status
-
getUser
public UserDetailsResponse getUser(java.lang.Long userId, java.security.Principal principal)
Get the details for a specific user- Parameters:
userId
- - the id for the user to show details forprincipal
- - the currently logged in user- Returns:
UserDetailsResponse
that contains user details for a specific user
-
updateUser
public AjaxSuccessResponse updateUser(java.lang.Long userId, UserEditRequest userEditRequest, java.security.Principal principal, javax.servlet.http.HttpServletRequest request, java.util.Locale locale) throws UIUserFormException
Submit a user edit- Parameters:
userId
- The id of the user to edit (required)userEditRequest
- aUserEditRequest
containing details about a specific userprincipal
- a reference to the logged in userrequest
- the requestlocale
- logged in usersLocale
- Returns:
- a success message
- Throws:
UIUserFormException
- if there are errors updating the user
-
changeUserPassword
public AjaxSuccessResponse changeUserPassword(java.lang.Long userId, java.lang.String oldPassword, java.lang.String newPassword, java.security.Principal principal, javax.servlet.http.HttpServletRequest request, java.util.Locale locale) throws UIUserFormException
Change the password of a user- Parameters:
userId
- The id of the user to edit (required)oldPassword
- The old password of the user for password changenewPassword
- The new password of the user for password changeprincipal
- a reference to the logged in userrequest
- the requestlocale
- logged in usersLocale
- Returns:
- a success message
- Throws:
UIUserFormException
- if there is an error changing the password
-
adminNewPasswordReset
public AjaxSuccessResponse adminNewPasswordReset(java.lang.Long userId, java.security.Principal principal, java.util.Locale locale) throws UIEmailSendException
Create a newPasswordReset
for the givenUser
- Parameters:
userId
- The ID of theUser
principal
- a reference to the logged in user.locale
- a reference to the locale specified by the browser.- Returns:
- text to display to the user about the result of creating a password reset.
- Throws:
UIEmailSendException
- if there is an error emailing the password reset.
-
-