Recent Atlassian GDPR Changes

Problem

When scripting with routines such as getUserByFullName() or currentUser(), the format of the user key returns an unexpected result such as, "JIRAUSER10000". 

Background

Starting with Jira 8.2, user keys have been changed to protect user identity in order to comply with GDPR regulations. For more information, see these Atlassian pages describing the change:

https://www.atlassian.com/trust/privacy/gdpr

https://confluence.atlassian.com/jiracore/gdpr-changes-in-jira-975041009.html

Converting the User Key to Username

If you have existing scripts that were written before Jira 8.2, chances are they were written with the assumption that the user key and username are basically the same. Due to the changes Atlassian has implemented, it is no longer the case that user keys and user names are the same. To that end, you must modify scripts that have routines that return user keys intended for use as usernames.

To convert the userkey to the username, try the following with the userKeyToUsername() routine:

userKeyToUsername("userkey goes here")

OR

userKeyToUsername(currentUser())

For example:

string userName = userKeyToUserName(currentUser());

 

For more information on the userKeyToUsername() routine, see this documentation:

https://appfire.atlassian.net/wiki/pages/createpage.action?spaceKey=SIL&title=userKeyToUsername

For a complete list of data available from the JUser struct, see this reference on predefined structure types:

Inconsistent "User" Results

All the changes made to the user key and user name have been made by Atlassian. Consider exploring the user tables in your Jira instance such as "app_user" and "cwd_user" to get a better idea of how user keys and usernames are handled on the backend.

 

You can use a third-party database app to conduct queries such as pgAdmin. To use the sql() routine as posted above, you must first create a database connection to Jira's database. Please see the documentation below on how to do that:

Here is the documentation for the sql routine:

The following Atlassian documentation seems to be a good outline of navigating user tables.

Additional Help

Need help implementing this script? Talk to me directly to me by clicking on the bot on this page.

Filter by label

There are no items with the selected labels at this time.