Class UsersAjaxController


  • @RestController
    @RequestMapping("/ajax/users")
    public class UsersAjaxController
    extends java.lang.Object
    Handles asynchronous requests for the administration users table.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.springframework.http.ResponseEntity<AjaxResponse> adminNewPasswordReset​(java.lang.Long userId, java.security.Principal principal, java.util.Locale locale)
      Create a new PasswordReset for the given User
      org.springframework.http.ResponseEntity<AjaxResponse> 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 for a user
      org.springframework.http.ResponseEntity<AjaxResponse> createUser​(UserCreateRequest userCreateRequest, java.security.Principal principal, java.util.Locale locale)
      Create a new user
      org.springframework.http.ResponseEntity<UserDetailsResponse> getUserDetails​(java.lang.Long userId, java.security.Principal principal)
      Get the details for a specific user
      TableResponse<UserDetailsModel> getUsersPagedList​(AdminUsersTableRequest request)
      Get a paged listing of users for the administration user.
      org.springframework.http.ResponseEntity<AjaxResponse> updateUser​(java.lang.Long userId, UserEditRequest userEditRequest, java.security.Principal principal, javax.servlet.http.HttpServletRequest request, java.util.Locale locale)
      Submit a user edit
      org.springframework.http.ResponseEntity<AjaxResponse> updateUserStatus​(java.lang.Long id, boolean isEnabled, java.util.Locale locale)
      Update a user status (if the user is enabled within IRIDA).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • UsersAjaxController

        @Autowired
        public UsersAjaxController​(UIUsersService uiUsersService)
    • Method Detail

      • getUsersPagedList

        @RequestMapping("/list")
        public TableResponse<UserDetailsModel> getUsersPagedList​(@RequestBody
                                                                 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

        @RequestMapping(value="/create",
                        method=POST)
        public org.springframework.http.ResponseEntity<AjaxResponse> createUser​(@RequestBody
                                                                                UserCreateRequest userCreateRequest,
                                                                                java.security.Principal principal,
                                                                                java.util.Locale locale)
        Create a new user
        Parameters:
        userCreateRequest - a UserCreateRequest containing details about a specific user
        principal - a reference to the logged in user
        locale - the logged in user's request locale
        Returns:
        the id of the new user
      • updateUserStatus

        @RequestMapping("/edit")
        public org.springframework.http.ResponseEntity<AjaxResponse> updateUserStatus​(@RequestParam
                                                                                      java.lang.Long id,
                                                                                      @RequestParam
                                                                                      boolean isEnabled,
                                                                                      java.util.Locale locale)
        Update a user status (if the user is enabled within IRIDA).
        Parameters:
        id - - the identifier for the User whom status is being updated.
        isEnabled - - Boolean value whether the User should be enabled or not.
        locale - - the Locale of the current user.
        Returns:
        ResponseEntity internationalized response to the update
      • updateUser

        @RequestMapping(value="/{userId}/edit",
                        method=POST)
        public org.springframework.http.ResponseEntity<AjaxResponse> updateUser​(@PathVariable
                                                                                java.lang.Long userId,
                                                                                @RequestBody
                                                                                UserEditRequest userEditRequest,
                                                                                java.security.Principal principal,
                                                                                javax.servlet.http.HttpServletRequest request,
                                                                                java.util.Locale locale)
        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 - the logged in user's request locale
        Returns:
        a status message
      • changeUserPassword

        @RequestMapping(value="/{userId}/changePassword",
                        method=POST)
        public org.springframework.http.ResponseEntity<AjaxResponse> changeUserPassword​(@PathVariable
                                                                                        java.lang.Long userId,
                                                                                        @RequestParam(required=false)
                                                                                        java.lang.String oldPassword,
                                                                                        @RequestParam
                                                                                        java.lang.String newPassword,
                                                                                        java.security.Principal principal,
                                                                                        javax.servlet.http.HttpServletRequest request,
                                                                                        java.util.Locale locale)
        Change the password for 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 - the logged in user's request locale
        Returns:
        a status message
      • getUserDetails

        @RequestMapping("/{userId}")
        public org.springframework.http.ResponseEntity<UserDetailsResponse> getUserDetails​(@PathVariable("userId")
                                                                                           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:
        a UserDetailsResponse containing the details for a specific user
      • adminNewPasswordReset

        @RequestMapping(value="/{userId}/reset-password",
                        method=POST)
        @PreAuthorize("hasAnyRole(\'ROLE_ADMIN\', \'ROLE_MANAGER\')")
        public org.springframework.http.ResponseEntity<AjaxResponse> adminNewPasswordReset​(@PathVariable
                                                                                           java.lang.Long userId,
                                                                                           java.security.Principal principal,
                                                                                           java.util.Locale locale)
        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.