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

Strange behavior when updating usernames in Jira

    XMLWordPrintable

Details

    Description

      Issue Summary

      When updating a user name in Jira such as naming a user in an LDAP as the same username as an internal user, this can cause some undesirable behavior if you choose to rename one of the users back to their previous/any other username. Similar to JRASERVER-36594.

      Steps to Reproduce

      1. Set up Jira to a connector LDAP directory.
      2. Create two users, test and testtester. One in the internal and the other in the LDAP directory.
      3. Rename the LDAP user to match the internal directory user. Jira will recognize this user as the same user since the name matches between directories.
      4. Rename the LDAP user back to their previous username(testtester) or any other username.

      Expected Results

      This will update the current record inside of Jira's app_user table so it recognizes the user as its previous user.

      Actual Results

      When you change the user back to their old username in LDAP so they don't match the internal users username, Jira creates an app_user record for a brand new user and then renames the historical record of the user name with a #1 behind it but nothing gets added to cwd_user so the relationship ends up being broken.

      Before Test

      app_user table:

      j890=# select * from app_user;
        id   |   user_key    | lower_user_name 
      -------+---------------+-----------------
       10000 | JIRAUSER10000 | admin
       10100 | JIRAUSER10100 | java
       10101 | JIRAUSER10101 | test
       10102 | JIRAUSER10102 | testtester
      (4 rows)
      

      After Test

      app_user table:

      j890=# select * from app_user;
        id   |   user_key    | lower_user_name 
      -------+---------------+-----------------
       10000 | JIRAUSER10000 | admin
       10100 | JIRAUSER10100 | java
       10101 | JIRAUSER10101 | test
       10102 | JIRAUSER10102 | testtester#1
       10103 | JIRAUSER10103 | testtester
      

      Notes

      This causes some undesirable behavior where the old user record cannot be interacted with in the GUI if they were an assignee of an issue before the username change. Example:

      Here, we can see the broken Assignee record in the JQL results. This user can be changed as the assignee but this shows the broken relationship between what's in the GUI compared to what's in the database since the link for the user between app_user and cwd_user gets broken.

      Workaround

      If you plan to rename an LDAP user to an existing user_name of the internal directory, the following steps can avoid this behavior:

      1. Disable the LDAP directory;
      2. Move the internal directory to the top of the list;
      3. Rename the internal users to something different;
      4. Rename the LDAP users to the target username;
      5. Enable the directory and move it back to the top of the list.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jsanchez2@atlassian.com Jeremy Sanchez
              Votes:
              5 Vote for this issue
              Watchers:
              21 Start watching this issue

              Dates

                Created:
                Updated: