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

Show username instead of user key in the audit logs when a user is added to a project role

      Description

      When a user is added to a project role, when checking the Audit logs, this user is referred to by its "user key" instead of its username:

      With the recent GDPR changes introduced in Jira 8.4, the user keys or newly created users have the format JIRAUSERXXXXX, which makes it impossible to know which users were added to a specific role from the Audit Logs. Instead, the Jira admin user needs to have access to the DB and query the app_user table to find the relationship between the user key and the user name.

      Step to reproduce

      1. Install Jira 8.4 or any higher version
      2. Create a new user
      3. Add this user to any project role
      4. Go to the page ⚙ > System > Audit Logs
      5. Look for the entry corresponding to the addition of the user to a project role, and verify that the user key is displayed instead of the username

      Suggestion

      Instead of using user_key, the Audit Logs should show the username as it's more relevant to the users. Note that it's already the case when a user is added to a group (as shown in the screenshot below), so the Audit Logs should be consistent and show the username whenever some modifications is made to a user.

      Workaround

      You may leverage the following front-end based workaround, which upon loading the Project based or Global based audit logs, will dynamically look up and replace user keys with their user names. v3 has been tested on Jira 8.20.10 only, v3.1 only on 9.12.6. It might not work on other versions.

      Installing

      1. Add the following script to Jira's Announcement Banner:
        1. For Jira 8.20 - JRASERVER-71189-v3.js
          OR
        2. For Jira 9.12 - JRASERVER-71189-v3.1.js

      Theory of operation

      • We place a script in Jira's announcement banner. It only loads on the Audit log pages
      • When a user clicks on a button, the script check's if the row for the button is a "Project role changed" row. If it is, then it will find user keys within the audit entry, and individually sends a request to the server to obtain the user object for the keys listed
      • The returned value from the server contains the username and the user key. The script finds all other occurrences to this user key within the Audit log page, and replaces them with the user key. This is a performance optimisation to avoid repeat lookups. It also marks the changed entries as modified, so entries already resolved won't get resolved again upon row expansion/contraction
      • The script considers contacting the server as little as possible. For any given page of data, a user key is only requested once, even if it has multiple entries in the page. Data isn't loaded in bulk, so the maximum sequentially queued requests to the server is equal to the unique number of usernames within the row that was expanded

      Limitations

      • The script relies on a specific construction of the DOM, so changes between Jira versions may break the script. As such there is no guarantee it would work on a future version of Jira
      • It does not fix the audit log REST API nor does it fix the export feature

       

        1. AuditLog_ProjectRole.png
          AuditLog_ProjectRole.png
          65 kB
        2. AuditLog_UserManagement.png
          AuditLog_UserManagement.png
          32 kB
        3. JRASERVER-71189-v3.1.js
          6 kB
        4. JRASERVER-71189-v3.js
          5 kB

          Form Name

            [JRASERVER-71189] Show username instead of user key in the audit logs when a user is added to a project role

            Craig Castle-Mead added a comment - - edited

            A huge thanks to Alex from Premier Support who helped formulate the workaround javascript. I can confirm that this works in our very complex environment (8.20.x)

            CCM

            Craig Castle-Mead added a comment - - edited A huge thanks to Alex from Premier Support who helped formulate the workaround javascript. I can confirm that this works in our very complex environment (8.20.x) CCM

            This issue stops our governance admins from being able to audit role changes affectively within projects.

            Ben Robbins added a comment - This issue stops our governance admins from being able to audit role changes affectively within projects.

            Issa added a comment -

            When extracting report from issue history I'm getting same error.

            It's affecting the reports and time consuming also creating confusion for the users who is extracting reports.

            Issa added a comment - When extracting report from issue history I'm getting same error. It's affecting the reports and time consuming also creating confusion for the users who is extracting reports.

            We understand that the GDPR concerns. But at the same time Jira admin is losing the traceability in Jira UI.  It also creating a lot of confusion. This is  time consuming and not a cost friendly at all. These issues JRASERVER-68450 AND JRASERVER-61871 are concerning and raising questions. Please fix this ASAP. 

            Nirmani.Kalakheti added a comment - We understand that the GDPR concerns. But at the same time Jira admin is losing the traceability in Jira UI.  It also creating a lot of confusion. This is  time consuming and not a cost friendly at all. These issues  JRASERVER-68450  AND  JRASERVER-61871  are concerning and raising questions. Please fix this ASAP. 

            Yuri Astafev added a comment - - edited

            good day!

            the same case is reproduced in Server v8.8.1. also new users displayed the same way in issue history.

            Yuri Astafev added a comment - - edited good day! the same case is reproduced in Server v8.8.1. also new users displayed the same way in issue history.

              Unassigned Unassigned
              jrey Julien Rey
              Affected customers:
              53 This affects my team
              Watchers:
              40 Start watching this issue

                Created:
                Updated: