Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Bulk update to permissions and repos

Deleted user March 22, 2022

Hello all,

I am racing towards a deadline and urgently need to automate the following, Any help will be greatly appreciated.

  1. Extract all permissions on all repos
  1. Figure out a script or a way to bulk modify the permissions on specific repos

  2. Figure out a script or a way to bulk add users to groups and modify repos to grant permission to users within these groups.

  3. Figure out a script or a way to bulk delete users from a group.

 

I will be thankful if anyone can provide info on how to do this for BitBucket.

Thanks

Junaid

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 25, 2022

Hi Junaid,

I see that you have created a support ticket for this issue and your questions have been answered there. I'll leave a reply here as well for any other users who may come across your post with the same questions.

Please allow me to give some context first, there are two ways for a user to gain/have access to a repo:

  1. they can be granted direct access from Repository settings > User and group access > Add members
  2. they can have access via a user group, i.e. be invited to a user group that has access to the repo

Regarding your questions:

Extract all permissions on all repos

You can use the following endpoint:

Please note the following:

Permissions returned are effective permissions: the highest level of permission the user has. This does not distinguish between direct and indirect (group) privileges.

 

Figure out a script or a way to bulk modify the permissions on specific repos

If a user has direct access to a repo, it is not possible to modify their permissions via API, this needs to be done via the UI.

It is possible to modify the permissions of a certain user group via API using the following endpoint:

 

Figure out a script or a way to bulk add users to groups

You can invite a user to a user group with the following endpoint:

 

modify repos to grant permission to users within these groups.

If the user group already has access to a certain repo, you don't need to take any action. However, if the user group doesn't have access to a repo, you can use the following endpoint to add the user group to a repo:

Figure out a script or a way to bulk delete users from a group.

You can use the following endpoint:

Please note that if a user has direct repo access, in addition to access via a user group, it is not possible to revoke that direct access via API.

We have a feature request about this in our issue tracker: https://jira.atlassian.com/browse/BCLOUD-19896

Kind regards,
Theodora

Deleted user March 30, 2022

Hi Theodora,

 

Thank you very much for the detailed response. We were able to automate a lot of user management through your guidance as well as through the Atlassian support.

 

Have a great day.

 

Junaid

Like Theodora Boudale likes this
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 1, 2022

Hi Junaid,

That's good to hear and you are very welcome.

Please feel free to reach out if you ever need anything else!

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events