Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Checking Admin Permissions for Triggering Custom Pipelines via API

Vish November 6, 2023

 Hello,

I'm setting up a custom pipeline in Bitbucket and need to verify whether the user who triggers the pipeline has admin permissions. I attempted to check permissions with an API call to:

GET https://api.bitbucket.org/2.0/repositories/$BITBUCKET_REPO_OWNER/$BITBUCKET_REPO_SLUG/permissions-config/users/$BITBUCKET_STEP_TRIGGERER_UUID

However, this returns no data since users have been added to the repository as part of a group, not individually. How can I check if the pipeline triggerer is an admin, especially when permissions are assigned via groups?

I need to resolve this promptly to proceed with pipeline configuration. Any assistance would be greatly appreciated.

Thanks!

1 answer

0 votes
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 8, 2023

Hi @Vish!

If permissions are assigned only via groups, you can first use the following API endpoint to list group permissions for this repo:

The field you need to look at in the output for each group is the permission (and not the default_permission, as the latter may be different than the actual permission). This way you can filter which groups have admin permissions to this repo.

Afterwards, you can use the following API endpoint from version 1 of our API to get group members for each group that has admin permission to the repo:

You will then have a list of users with admin permission to the repo. You can then check if the UUID of the user that triggered the pipeline belongs in that list.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events