info command deals with groups

This commit is contained in:
Sitaram Chamarty 2012-03-15 06:07:41 +05:30
parent 5ebb981efa
commit 6624d35cf9
3 changed files with 39 additions and 19 deletions

View file

@ -119,6 +119,7 @@ sub load_common {
sub load_1 { sub load_1 {
my $repo = shift; my $repo = shift;
return if $repo =~ /^\@/;
trace( 4, $repo ); trace( 4, $repo );
_chdir("$rc{GL_REPO_BASE}/$repo.git"); _chdir("$rc{GL_REPO_BASE}/$repo.git");

View file

@ -19,13 +19,23 @@ usage() if @ARGV;
my $user = $ENV{GL_USER} or _die "GL_USER not set"; my $user = $ENV{GL_USER} or _die "GL_USER not set";
my $ref = 'any'; my $ref = 'any';
my $fn = lister_dispatch('list-repos'); my $lr = lister_dispatch('list-repos');
my $lm = lister_dispatch('list-members');
for ( @{ $fn->() } ) { for ( @{ $lr->() } ) {
my $perm = ''; my $perm = '';
for my $aa (qw(R W ^C)) { for my $aa (qw(R W ^C)) {
my $ret = access($_, $user, $aa, $ref); my $ret = access($_, $user, $aa, $ref);
$perm .= ( $ret =~ /DENIED/ ? " " : " $aa" ); $perm .= ( $ret =~ /DENIED/ ? " " : " $aa" );
} }
print "$perm\t$_\n" if $perm =~ /\S/; next unless $perm =~ /\S/;
if (/^\@/) {
print "\n$perm\t$_\n";
for ( @{ $lm->($_) } ) {
print "$perm\t$_\n";
}
print "\n";
} else {
print "$perm\t$_\n";
}
} }

View file

@ -6,12 +6,13 @@ use warnings;
use lib "src"; use lib "src";
use Gitolite::Test; use Gitolite::Test;
try 'plan 35'; try 'plan 45';
try "## info"; try "## info";
confreset;confadd ' confreset;confadd '
repo t1 @t1 = t1
repo @t1
RW = u1 RW = u1
R = u2 R = u2
repo t2 repo t2
@ -30,23 +31,31 @@ try "
"; ";
try " try "
glt info u1; ok; gsh glt info u1; ok; gsh
/R W *\tt1/ /R W \t\@t1/
/R *\tt2/ /R W \tt1/
/R \tt2/
!/t3/ !/t3/
/ R W *\ttesting/ /R W \ttesting/
glt info u2; ok; gsh glt info u2; ok; gsh
/R *\tt1/ /R \t\@t1/
/R W *\tt2/ /R \tt1/
/R W \tt2/
!/t3/ !/t3/
/ R W *\ttesting/ /R W \ttesting/
glt info u3; ok; gsh glt info u3; ok; gsh
/R W *\tt3/ /R W \tt3/
!/t1/ !/\@t1/
!/t2/ !/t[12]/
/ R W *\ttesting/ /R W \ttesting/
glt info u4; ok; gsh glt info u4; ok; gsh
/R *\tt3/ /R \tt3/
!/t1/ !/\@t1/
!/t2/ !/t[12]/
/ R W *\ttesting/ /R W \ttesting/
glt info u5; ok; gsh
!/t[123]/
/R W \ttesting/
glt info u6; ok; gsh
!/t[123]/
/R W \ttesting/
" or die; " or die;