diff options
author | Lars Wirzenius <liw@liw.fi> | 2013-10-11 18:57:03 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2013-10-11 18:57:03 +0100 |
commit | 0c4a196cb0d72a8919207001374a3c7c31913733 (patch) | |
tree | 76f4d3ffca428ba48a0e4bbfd1d77f1e08881998 | |
parent | e529aacf9e05d4196f02d5b4e9cf9317d00924f0 (diff) | |
download | liw-gitano-acl-test-suite-0c4a196cb0d72a8919207001374a3c7c31913733.tar.gz |
Test non-admin can only push to their own branches
-rw-r--r-- | git.liw.fi.sh | 16 | ||||
-rw-r--r-- | git.liw.fi.yarn | 17 |
2 files changed, 27 insertions, 6 deletions
diff --git a/git.liw.fi.sh b/git.liw.fi.sh index 6f20266..d7df0b5 100644 --- a/git.liw.fi.sh +++ b/git.liw.fi.sh @@ -118,6 +118,22 @@ clone_with_ssh() } +# Push repo over ssh. + +push_with_ssh() +{ + local user="$1" + shift + if [ "$user" = admin ] + then + git push "$@" + else + KEYFILE="$DATADIR/$user.key" \ + PATH="$SRCDIR:$PATH" git push "$@" + fi +} + + # Remove a repository from the server. This is a two-step process. destroy_repo() diff --git a/git.liw.fi.yarn b/git.liw.fi.yarn index 69758a3..cfa1c74 100644 --- a/git.liw.fi.yarn +++ b/git.liw.fi.yarn @@ -119,7 +119,8 @@ repo. FINALLY remove repository tstrepo on server -Non-admin, however, shouldn't be able to push to master. +Non-admin, however, shouldn't be able to push to master, but should be +able to push to a branch prefixed by their username. SCENARIO non-admin cannot push to master ASSUMING no tstusr user exists on server @@ -129,10 +130,14 @@ Non-admin, however, shouldn't be able to push to master. AND admin creates repository tstrepo AND tstusr clones tstrepo over ssh AND tstusr makes change to master in tstrepo - WHEN tstusr attempts to push master in tstrepo - THEN attempt failed with error matching "FIXME" + AND tstusr attempts to push master in tstrepo + THEN attempt failed with error matching "Rules refused update" + + WHEN tstusr makes change to tstusr/foo in tstrepo + THEN tstusr can push tstusr/foo in tstrepo FINALLY remove repository tstrepo on server + AND remove user tstusr on server Implementation sections ======================= @@ -383,21 +388,21 @@ A named user pushes a branch to a repository. IMPLEMENTS THEN (\S+) can push (\S+) in (\S+) cd "$DATADIR/$MATCH_1/$MATCH_3" git checkout "$MATCH_2" - git push origin HEAD + push_with_ssh "$MATCH_1" origin HEAD Push with tags. IMPLEMENTS THEN (\S+) can push (\S+) with tags in (\S+) cd "$DATADIR/$MATCH_1/$MATCH_3" git checkout "$MATCH_2" - git push --tags origin HEAD + push_with_ssh "$MATCH_1" --tags origin HEAD Attempt to push, when the outcome may be uncertain. IMPLEMENTS WHEN (\S+) attempts to push (\S+) in (\S+) cd "$DATADIR/$MATCH_1/$MATCH_3" git checkout "$MATCH_2" - attempt git push origin HEAD + attempt push_with_ssh "$MATCH_1" origin HEAD Cgit access ----------- |