How do I find which users count against my Bitbucket Server license?

Still need help?

The Atlassian Community is here for you.

Ask the community

This Knowledge Base article was written specifically for the Atlassian Server platform. Due to the Functional differences in Atlassian Cloud, the contents of this article cannot be applied to Atlassian Cloud applications.

Problem

The number of licensed users is exhausted but it isn't evident what users are occupying license seats.

Resolution #1

Use the following REST endpoint to get details of all users licensed to use Bitbucket Server:

curl -u <admin-user> -X GET <bitbucket_url>/rest/api/1.0/users?permission=LICENSED_USER&limit=1000

This will return a JSON object which can be filtered to list just the names of the users:

curl -u <admin-user> -X GET <bitbucket_url>/rest/api/1.0/users?permission=LICENSED_USER\&limit=1000 2>/dev/null | json_pp | grep displayName | awk -F':' '{print $2}'


Resolution #2

Development wrote a small plugin that will help determine what users Bitbucket Server sees:

  1. Log in to Bitbucket Server as an administrator and go to Administration > Manage Add-on and click on "Upload add-on".
  2. Paste the following URL into the "From this URL" field and click "Upload": https://packages.atlassian.com/maven/com/atlassian/bitbucket/plugins/user-permission-debugger/0.9.0/user-permission-debugger-0.9.0.jar
    You can also go to the link to download the jar and use the upload option.
  3. Wait for the plugin to install, then:

    • Enable the additional trace log level required:
curl -u <admin_user> -v -k -X PUT -d "" -H "Content-Type: application/json" <bitbucket_url>/rest/api/latest/logs/logger/com.atlassian.stash.internal.user.PermissionServiceImpl/trace
    • Browse to <bitbucket_url>/plugins/servlet/users-with/LICENSED_USER which will display the active users.

Also, open <bitbucket_home>/log/atlassian-bitbucket.log as it will have output identifying how each user is granted the LICENSED_USER permission. Look for the following output specifically:

c.a.s.i.user.PermissionServiceImpl Switching to log level [TRACE]
c.a.s.i.user.PermissionServiceImpl Calculating users with the LICENSED_USER permission
... output listing users and explicit/implicit permissions ...
c.a.s.i.user.PermissionServiceImpl Switching to log level [INFO]

A sample permission will look like the following:

"GET /plugins/servlet/users-with/LICENSED_USER HTTP/1.1" c.a.s.i.user.PermissionServiceImpl user = InternalNormalUser{id=1, username=charlie}, resource = null, requested permission = ADMIN

The plugin is locked down to administrators but it can be uninstalled from the Manage Plugins screen if preferred.


Existing feature request

BSERV-7571 - Getting issue details... STATUS


Description The number of licensed users is exhausted but it isn't evident what users are occupying license seats.
Last modified on Mar 22, 2019

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.