Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-9921

Change a user's password remotely

    XMLWordPrintable

Details

    • We collect Jira feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

    Description

      NOTE: This suggestion is for JIRA Server. Using JIRA Cloud? See the corresponding suggestion.

      I would like to be able to change a user's password remotely.

      Suggested API and implementation as follows:

      void changePassword(User admin, String username, String password)
      throws RemoteException, RemoteValidationException, RemotePermissionException;
      public void changePassword(User admin, String username, String password)
        throws RemoteException, RemoteValidationException, RemotePermissionException {
              if (!permissionManager.hasPermission(Permissions.ADMINISTER, admin))
              {
                  throw new RemotePermissionException("You do not have permission to administer a user.");
              }
              if (username == null || "".equals(username))
              {
                  throw new RemoteValidationException("username needs a value");
              }
              if (password == null || "".equals(password))
              {
                  throw new RemoteValidationException("password needs a value");
              }
              // IS THIS NECESSARY?  Copied from deleteUser()
              if (applicationProperties.getOption(APKeys.JIRA_OPTION_USER_EXTERNALMGT))
              {
                  throw new RemotePermissionException("Cannot change password, as external user management is enabled.");
              }
      
              User user = null;
              try
              {
                  user = userManager.getUser(username);
              }
              catch (EntityNotFoundException e)
              {
                  throw new RemoteValidationException("Unable to find user  " + username);
              }
      		
              try {
                  UserUtils.changePassword(user, password);
              } catch (ImmutableException e) {
                  throw new RemoteException("Unable to change password for " + user + ": " + e.getMessage(), e);
              }
      }
      

      I get deprecation warnings on UserUtils, but userManager does not expose the changePassword method.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              f01e870820d6 Asgeir Storesund Nilsen
              Votes:
              11 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: