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 .
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.
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 .
This article doesn't give list of users who have unlicensed attribute tagged .
#!/bin/bashBUSER=$1BPASSWD=$2BITBUCKET_URL=https://bitbucket.company.comif [ $# -ne 2 ]; thenecho "Usage: $0 [Bitbucket users] [Bitbucket password]"exit 1ficurl -s -u "$BUSER:$BPASSWD" -X GET "$BITBUCKET_URL/rest/api/1.0/users?permission=LICENSED_USER&limit=2000" | jq > /tmp/usersgrep 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 jqsudo yum install jq
It looks like you're new here. Sign in or register to get started.