Skip to end of banner
Go to start of banner

Recent Atlassian GDPR Changes

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

We've encountered an issue exporting this macro. Please try exporting this page again later.

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:

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.

string [] result = sql("jiraDB", "SELECT * FROM app_user");
runnerLog(result);

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:

SQL data sources

Here is the documentation for the sql routine:

sql

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

https://developer.atlassian.com/server/jira/platform/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.

Filter by label

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

  • No labels