Stash: Branch permission set via REST API not working

Hello,

when I set branch-permissions for my repository using the REST Api, users are still able to push directly to the branch, even if they shouldn't. In the stash UI, permissions are displayed like they should. When I resave the permissions manually, without making any modifications, the restrictions work as expected. Is this a bug in stash (using the latest version) or do I need to do something to make my changes actually apply?

2 answers

1 accepted

1 vote
Accepted answer

Oh now I see what I did wrong. I didnt use fully qualified branch names. Instead of refs/head/master I just used "master"

For me this:

curl -i -u user:pass -H "Accept: application/json" -H "Content-Type: application/json" -X POST -d "{\"type\": \"BRANCH\",\"value\": \"refs/heads/something\",\"groups\":[\"Group\"],\"users\":[\"user1\",\"user2\",\"user3\",\"user4\",\"user5\"]}" http://stash/rest/branch-permissions/1.0/projects/PROJECT/repos/REPO/restricted

works perfectly, with Stash 3.5.1

Can you post the exact command and your Stash version?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Nov 06, 2018 in Bitbucket

Upgrade Best Practices

Hello! My name is Mark Askew and I am a Premier Support Engineer for products Bitbucket Server/Data Center, Fisheye & Crucible. Today, I want to bring the discussion that Jennifer, Matt, and ...

250 views 3 7
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you