hi,
I would like to ask how can I get a list of all repositories a specific user has permissions to.
My goal is, as part of user off-boarding, is to remove all the individual/explicit permission a specific user has in all repositories.
There is this one, but the user is restricted to the caller calling the API (and owner of the credentials).
There is also this one but I need to specify the repository as well.
My organization has 1000+ repos and I don't want to call bitbucket api 1000+ times just to check if the user has access to all of them.
In the UI (Bitbucket> workspace settings > User Directory > (select a user then click View Access) we can see list of repositories that use has permissions to. Hope there's an equivalent in REST API as well.
Please help.
Thanks in advance!
Hello @Rocelito Abano gmail and welcome to the Community!
In case you are interested in a consolidated list of the repository permissions of users in a workspace (including inherited permissions from projects), I would suggest using the endpoint List all repository permissions for a workspace.
This endpoint will return an object for each repository permission for all repositories within a workspace.
Permissions returned are effective permissions: the highest level of permission the user has. This does not distinguish between direct and indirect (group) privileges.
Following is an example request to that endpoint filtering by a user whose name contains the word John :
https://api.bitbucket.org/2.0/workspaces/WORKSPACE/permissions/repositories?q=user.nickname+%7E+%22John%22
You can modify that query according to the results you are looking for by using filtering, sorting and partial results.
Also, if your end goal is to fully revoke access of a user in the workspace (removing the user from any groups and any direct permission to repositories/projects as well), you will find a remove option by navigating to Workspace Settings > User Directory > in the line of the user you want to remove click on the Tree dot icon > Remove. This will fully remove the user's access to any content on the workspace.
Thank you, @Rocelito Abano gmail !
Patrik S
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.