Recent Atlassian GDPR Changes

Problem

When scripting with functions 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:

GDPR | Atlassian

GDPR changes in Jira | Atlassian Support | Atlassian Documentation

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 functions that return user keys intended for use as usernames.

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

userKeyToUsername("userkey goes here")

OR

userKeyToUsername(currentUser())

For example:

string userName = userKeyToUserName(currentUser());

 

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

userKeyToUsername

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

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() function as posted above, you must first create a database connection to Jira's database. Please see the documentation below on how to do that:

SQL data sources

Here is the documentation for the sql function:

sql

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

Database – User and Group tables

Additional Help

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

Related articles

Filter by label

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