I want to know list of unlicenced users on BitBucket

Rajat Roy April 2, 2024

In our Bitbucket Data Centre we want to find out a list of users who have gone unlicensed  because of not logging or inactivity . 

I want to know if there is a way get the details of all those users so that we can have proper governance in place . 

3 answers

1 vote
John Lawlor
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 9, 2024
#!/bin/bash

BUSER=$1
BPASSWD=$2
BITBUCKET_URL=https://bitbucket.company.com

if [ $# -ne 2 ]; then
echo "Usage: $0 [Bitbucket users] [Bitbucket password]"
exit 1
fi

curl -s -u "$BUSER:$BPASSWD" -X GET "$BITBUCKET_URL/rest/api/1.0/users?permission=LICENSED_USER&limit=2000" | jq > /tmp/users

grep displayName /tmp/users | cut -d ":" -f 2 | sed -e 's/"//' | sed -e 's/",//'

This script requires jq which you can install with your package manager:

sudo apt install jq

sudo yum install jq

 

1 vote
Rajat Roy April 2, 2024

Also is there a way to figure out how many users have generated tokens for their accounts ? 

Suppose a user doesnt login but is using his token in jobs , and if we remove him , his token can get invalid . 

So we want to get this details as well . 

1 vote
Perisic Nikola
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 2, 2024

Hello @Rajat Roy 

This will help you out: https://stackoverflow.com/questions/49616922/in-bitbucket-api-how-can-i-get-a-list-of-all-licensed-users

Look for the answer from Marcelo. And also the comment from  dave right bellow Marcelo's answer where it says that the mentioned code snippet from the page also includes the unlicensed users.

Rajat Roy April 2, 2024

This article doesn't give list of users who have unlicensed attribute tagged . 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events