How to get a list of licensed users with "created" and "last authenticated" data with Bitbucket Server and Data Center
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
The content on this page relates to platforms which are not supported. Consequently, Atlassian Support cannot guarantee providing any support for it. Please be aware that this material is provided for your information only and using it is done so at your own risk.
The article explains how to get a list of licensed users with information about when they last logged in ("last authenticated" data) and when the accounts were created.
Environment
Bitbucket 8.9.4, but also applicable to other versions.
Solution
The following database query provides a list of licensed users with information about when they last logged in ("last authenticated" data) and when the accounts were created.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
-- list of licensed users with created and last authenticated dates
select
snu.name as username,
cu.created_date,
date(to_timestamp(cua.attribute_value::decimal/1000)) as last_authenticated
from sta_normal_user snu
join cwd_user cu on cu.lower_user_name = snu."name"
left join cwd_user_attribute cua on cua.user_id = cu.id and cua.attribute_name = 'lastAuthenticationTimestamp'
where exists (
select * from sta_global_permission where user_id = snu.user_id
)
or exists (
select * from cwd_membership where lower_parent_name in (
select group_name from sta_global_permission
)
and child_name = snu.name
)
order by last_authenticated;
Was this helpful?