Jira Tempo users are pseudonymised

389 Views Asked by At

I am trying to obtain the worklogs using the Jira Tempo REST API. The server I am working with is an on-premises one. The data extraction is straightforward with one exception: some users are renamed from john.doe to JIRAUSER12345.

I could not find any rule for this and I also couldn't find any way to map the JIRAUSER12345 to the actual username. Is there any way of getting the real user name? Is it possible that I am missing some access rights (probably at team level) that forbid me seeing the real user names?

1

There are 1 best solutions below

0
On

Reading this article gives the reason for the anonymization: https://tempo-io.atlassian.net/wiki/spaces/KB/pages/1196327022/Why+do+I+see+JIRAUSERxxxx+as+worklog+author

In order to get the correct user id I did something like:

usersCache = {}
def getUserbyKey(key):
    if not key in usersCache:
        query = {
            'key': key
        }
        response = requests.get(f"{JIRA_BASE_URL}/rest/api/latest/user",auth=authorization, headers=headers, params=query)
        j = response.json()
        usersCache[key]=j["displayName"]
    j = usersCache.get(key)
    return j

...

for wl in worklogs:
    user = getUserbyKey(wl["worker"])
    key = wl["issue"]["key"]
    timeSpent = wl["timeSpent"]