Created
April 19, 2016 01:27
-
-
Save cliffano/28d7e8f136f592a70d6176acb5c80485 to your computer and use it in GitHub Desktop.
Add group permission to multiple Stash repositories
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
user=<user> | |
pass=<pass> | |
base_url=<http://stash_host:stash_port> | |
project=<project> | |
repos="<repo1> <repo2> ... <repoN>" | |
permission=<REPO_READ|REPO_WRITE|REPO_ADMIN> | |
group=<group> | |
for REPO in ${repos}; do | |
echo "Adding ${group} group ${permission} permission to ${REPO}..." | |
curl -u ${user}:${pass} -X PUT -H "Content-Type: application/json" -kL "${base_url}/rest/api/1.0/projects/${project}/repos/${REPO}/permissions/groups?permission=${permission}&name=${group}" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment