You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
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!
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.