From 8da223f92a130256a7640d89b1508c2b1ef55ab4 Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Fri, 14 May 2010 16:35:37 +0530 Subject: [PATCH] (big-config) allow usergroup information to be passed in from outside [Please NOTE: this is all about *user* groups, not *repo* groups] SUMMARY: gl-auth-commmand can now take an optional list of usergroup names after the first argument (which is the username). See doc/big-config.mkd in the next commit or so --- src/gitolite.pm | 8 +++++++- src/gl-auth-command | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/gitolite.pm b/src/gitolite.pm index ff1ca5d..9501257 100644 --- a/src/gitolite.pm +++ b/src/gitolite.pm @@ -530,7 +530,13 @@ sub get_memberships { } # deal with returning user info first - return (@ret) unless $is_repo; + unless ($is_repo) { + # add in group membership info sent in via second and subsequent + # arguments to gl-auth-command; be sure to prefix the "@" sign to each + # of them! + push @ret, map { s/^/@/; $_; } split(' ', $ENV{GL_GROUP_LIST}) if $ENV{GL_GROUP_LIST}; + return (@ret); + } # enforce the rule about ignoring all wildcard matches if a non-wild match # exists while returning. (The @ret gating above does not adequately diff --git a/src/gl-auth-command b/src/gl-auth-command index 7e7faff..80fd393 100755 --- a/src/gl-auth-command +++ b/src/gl-auth-command @@ -71,6 +71,10 @@ if ($ARGV[0] eq '-s') { # first, fix the biggest gripe I have with gitosis, a 1-line change my $user=$ENV{GL_USER}=shift; # there; now that's available everywhere! +# if there are any more arguments, they're a list of group names that the user +# is a member of +$ENV{GL_GROUP_LIST} = join(" ", @ARGV) if @ARGV; + # ---------------------------------------------------------------------------- # logging, timestamp env vars # ----------------------------------------------------------------------------