Class UIUsersService


  • @Component
    public class UIUsersService
    extends java.lang.Object
    Handles service call for the administration of the IRIDA users.
    • 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

      • 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 an User
        isEnabled - - whether the user should be enabled.
        locale - - users Locale
        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 for
        principal - - 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 - a UserEditRequest containing details about a specific user
        principal - a reference to the logged in user
        request - the request
        locale - logged in users Locale
        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 change
        newPassword - The new password of the user for password change
        principal - a reference to the logged in user
        request - the request
        locale - logged in users Locale
        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 new PasswordReset for the given User
        Parameters:
        userId - The ID of the User
        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.