Uploaded image for project: 'Jira Cloud'
  1. Jira Cloud
  2. JRACLOUD-9921

Change a user's password remotely

    XMLWordPrintable

Details

    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

    Description

      NOTE: This suggestion is for JIRA Cloud. Using JIRA Server? 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:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: