summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--git.liw.fi.sh12
-rw-r--r--git.liw.fi.yarn21
2 files changed, 28 insertions, 5 deletions
diff --git a/git.liw.fi.sh b/git.liw.fi.sh
index f4245f1..b064ad5 100644
--- a/git.liw.fi.sh
+++ b/git.liw.fi.sh
@@ -34,3 +34,15 @@ user_exists()
{
ssh "$GITANO@$GITHOST" user | grep "^$1:"
}
+
+
+# Remove a user from the server. This is a two-step process.
+
+user_del()
+{
+ if run_gitano_as "$1" user del "$2" 2> "$DATADIR/temp"
+ then
+ secret=$(awk '{ s = $2 } END { print s }' "$DATADIR/temp")
+ run_gitano_as "$1" user del "$2" "$secret"
+ fi
+}
diff --git a/git.liw.fi.yarn b/git.liw.fi.yarn
index c04b26b..c39a0b7 100644
--- a/git.liw.fi.yarn
+++ b/git.liw.fi.yarn
@@ -38,6 +38,8 @@ The admin must be able to create and remove a user.
GIVEN an ssh key for tstusr
WHEN admin creates user tstusr
THEN user tstusr exists
+ WHEN admin removes user tstusr
+ THEN user tstusr doesn't exist
FINALLY remove user tstusr on server
Implementations
@@ -75,11 +77,20 @@ Verify a user exists on the server.
IMPLEMENTS THEN user (\S+) exists
user_exists "$MATCH_1"
-Clean up user.
+Remove a user.
- IMPLEMENTS FINALLY remove user (\S+) on server
- if run_gitano_as admin user del "$MATCH_1" 2> "$DATADIR/temp"
+ IMPLEMENTS WHEN (\S+) removes user (\S+)
+ user_del "$MATCH_1" "$MATCH_2"
+
+Verify a user doesn't exist on the server.
+
+ IMPLEMENTS THEN user (\S+) doesn't exist
+ if user_exists "$MATCH_1"
then
- run_gitano_as admin user del "$MATCH_1" \
- $(awk '{ s = $2 } END { print s }' "$DATADIR/temp")
+ die "User $MATCH_1 exists on server, but shouldn't"
fi
+
+Clean up user.
+
+ IMPLEMENTS FINALLY remove user (\S+) on server
+ user_del admin "$MATCH_1"