diff options
author | Lars Wirzenius <liw@liw.fi> | 2013-10-06 10:51:04 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2013-10-06 10:51:04 +0100 |
commit | 9f820e9c5c4ba5ce4be60d818205890a509f1529 (patch) | |
tree | a79cb829b9071f2d5d19208bdf0bfb44814d7823 /git.liw.fi.sh | |
parent | 611ca829bf707d80723764633aa497c6aa360483 (diff) | |
download | liw-gitano-acl-test-suite-9f820e9c5c4ba5ce4be60d818205890a509f1529.tar.gz |
Test that non-admin can't create users
Diffstat (limited to 'git.liw.fi.sh')
-rw-r--r-- | git.liw.fi.sh | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/git.liw.fi.sh b/git.liw.fi.sh index b064ad5..8e3ecd0 100644 --- a/git.liw.fi.sh +++ b/git.liw.fi.sh @@ -10,6 +10,20 @@ die() } +# Attempt to run something, which may fail. Store the stdout, +# stderr, and exit code in $DATADIR. + +attempt() +{ + if "$@" > "$DATADIR/attempt.stdout" 2> "$DATADIR/attempt.stderr" + then + echo 0 > "$DATADIR/attempt.exit" + else + echo $? > "$DATADIR/attempt.exit" + fi +} + + # Run gitano on the server using a desired ssh key. The key is # either the admin key (i.e., they key of whoever invoked the # test suite), or a test key we've created in $DATADIR. @@ -23,7 +37,7 @@ run_gitano_as() ssh "$GITANO@$GITHOST" "$@" else SSH_AUTH_SOCK= ssh -F "ssh.conf" -i "$DATADIR/$keyname.key" \ - "$GITANO@GITHOST" "$@" + "$GITANO@$GITHOST" "$@" fi } @@ -36,6 +50,15 @@ user_exists() } +# Create a user, including setting their ssh key. + +user_add() +{ + run_gitano_as "$1" user add "$2" name foo@example.com + run_gitano_as "$1" as "$2" sshkey add somekey < "$DATADIR/$2.key.pub" +} + + # Remove a user from the server. This is a two-step process. user_del() |