new functions (can_*, is_admin, in_group) for ADCs

(can_* == can_read, can_write, and can_create)

See top of contrib/adc/adc.common-functions for more on this.

Note: the old style (calling get_rights_and_owner with $repo, then
checking $perm_read, $perm_write, etc.), will still work fine.
This commit is contained in:
Sitaram Chamarty 2011-11-22 14:55:15 +05:30
parent d5d982d602
commit af6820a94b
12 changed files with 104 additions and 26 deletions

View file

@ -5,12 +5,12 @@
[ -z "$GL_RC" ] && die "ENV GL_RC not set"
[ -z "$2" ] && die "Usage: fork source_repo target_repo"
# get_rights_and_owner now also sets $repo; see comments in common functions
get_rights_and_owner $1; from=$repo
[ -z "$perm_read" ] && die "no read permissions on $from"
# all the can_* functions set $repo
can_read $1 || die "no read permissions on $repo"
from=$repo
get_rights_and_owner $2; to=$repo
[ -z "$perm_create" ] && die "no create permissions on $to"
can_create $2 || die "no create permissions on $repo"
to=$repo
# clone $from to $to
git clone --bare -l $GL_REPO_BASE_ABS/$from.git $GL_REPO_BASE_ABS/$to.git