How to anonymize disabled or deleted user in Jira


You, as a Jira admin, may face the issue that it is not possible to remove all the user related data if the user was deleted, and in some cases, if users were disabled.

To solve this problem, you can use the “Data Cleaner” module from the “Data Protection and Security Toolkit” for Jira.

How to anonymize “Display Name”, “Email”, “User Name”

It is possible to anonymize any text field and replace information about disabled/deleted users using custom templates. It will work only for text fields. For this, administrators should create a custom template and then create a number of rules to replace the user names, display names, and e-mail addresses.

1. Click on the “Create custom template” button.

2. Fill in all necessary fields, like template name, scope and fields.
3. Go to the “Data Processing Rules” tab and use “Create new rule” dialog to create 3 rules.

Do the same for display names and e-mail addresses.
After the creation of all rules, it should look similar to this:

(all “Search type” fields should have “Plain text” type)

How to anonymize all the User picker fields

The first workaround will help you to search/anonymize disabled/deleted users only for text fields, but if you need to find users in the user fields (like assignee, reporter, etc.) you have to do one more step. Unfortunately because of the limitations of the Jira REST API, you can not use the same “Data Processing rule” dialog to create a special rule for users. You can’t choose users in the user picker, but it is possible to use our API to create a rule due to a special Rest Call. Please execute the next JavaScript in the browser console with the correct parameters.

let templateId = 1; // Here should be your template id let userMap = {"yoursourceusername":"yourtargetusername"}; // it is map of the changes "sourceUser" -> "targetUser", it is possible to specify a few number of users here let serverUrl = ""; // Your server url console.log("Starting..."); let success = 0; let error = 0; let link = serverUrl + "/rest/actonic-gdpr/1.0/data-cleaner-template/rules"; Object.keys(userMap).forEach((key) => { console.log("> creating rule for '" + key + "' -> '" + userMap[key] + "'"); let sourceUser = key let targetUser = userMap[key] let data = { templateId: templateId, name: sourceUser + " -> " + targetUser, enabled: true, replaceType: "user", searchType: "user", searchString: sourceUser, replaceString: targetUser } $.ajax({ url: link, method: "PUT", async: false, headers: { "Content-Type": "application/json" }, data: JSON.stringify(data), success: function (data) { console.log(">>> ...created (" + JSON.stringify(data) + ")") success++; }, error: function (xhr) { console.log("> !! FAILED for '" + sourceUser + "' -> '" + targetUser + "', reason: (" + xhr.status + ") " + xhr.statusText); error++; } }) }); console.log("Finished!"); console.log("Created rules : " + success); console.log("Failed create : " + error);