From 18c69e8612fbbc922b811d2afaa47cdd1a0d7b45 Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Sun, 8 May 2011 11:22:42 +0530 Subject: [PATCH] su-getperms and su-setperms --- contrib/adc/su-getperms | 33 +++++++++++++++++++++++++++++++++ contrib/adc/su-setperms | 1 + 2 files changed, 34 insertions(+) create mode 100755 contrib/adc/su-getperms create mode 120000 contrib/adc/su-setperms diff --git a/contrib/adc/su-getperms b/contrib/adc/su-getperms new file mode 100755 index 0000000..bab7859 --- /dev/null +++ b/contrib/adc/su-getperms @@ -0,0 +1,33 @@ +#!/bin/sh + +# adc for someone with admin privs to invoke "setperms/getperms" on other +# users. + +# copy this file under both names (su-setperms and su-getperms). It'll figure +# out from the name what to do, since the code is almost the same for both +# cases. + +# usage + + # ssh gitolite su-setperms user1 reponame # expects STDIN, like setperms + # ssh gitolite su-getperms user1 reponame # prints existing perms, like getperms + +# WARNING: DO NOT NAME THIS SCRIPT "setperms" or "getperms". It won't work. + +. $(dirname $0)/adc.common-functions + +get_rights_and_owner gitolite-admin +[ -z "$perm_write" ] && die "just *what* are you trying to pull here, $GL_USER?" + +# find the command name; we don't do a lot of fancy checking -- we just go +# "safe" and assume that anything but a name of "su-setperms" runs getperms +cmd=getperms +echo $0 | grep su-setperms$ >/dev/null 2>&1 && cmd=setperms + +# user and repo +user="$1"; shift +repo="$1"; shift + +[ -z "$repo" ] && die requires two parameters: a username and a reponame + +SSH_ORIGINAL_COMMAND="$cmd $repo" $GL_BINDIR/gl-auth-command $user diff --git a/contrib/adc/su-setperms b/contrib/adc/su-setperms new file mode 120000 index 0000000..f1c2b0e --- /dev/null +++ b/contrib/adc/su-setperms @@ -0,0 +1 @@ +su-getperms \ No newline at end of file