How to calculate the alias used for replacing the Full Name of a deleted user in Confluence
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Please be aware that this material is provided for your information only and that you use it at your own risk.
Atlassian Supportcannot guarantee to provide any support for the code outlined on this pageas customisations are not covered underAtlassian Support Offerings.
As described in Delete or Disable Users under section "How deleted users appear to other people", once a user account has been deleted their identity will be anonymised and their full names will be replaced with an alias.
This document explains how that new alias is generated.
Solution
When a user is anonymised, their usernames will be replaced by theuser_keyand the Full Name of the user will be replaced by an alias like "user-{vwxyz}".
This {vwxyz} value is derived from theuser_key, calculating the SHA-256 digest in hexadecimal, and taking only the first 5 characters out of the result.
The following code is a simple snippet of how this alias can be calculated for any of your users:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
package DeletedAlias;
import java.nio.charset.StandardCharsets;
import static org.apache.commons.codec.digest.DigestUtils.sha256Hex;
public class DeletedAlias {
public static void main(String[] args) {
String userKeyString = "<USER_KEY_OF_YOUR_USER>";
String userKeyHash = sha256Hex(userKeyString.getBytes(StandardCharsets.UTF_8));
System.out.println("user-" + userKeyHash.substring(0, 5));
}
}
In order to get the user_key of one specific user, you can query the USER_MAPPING table in your Confluence database.
Was this helpful?