diff options
author | Sitaram Chamarty <sitaram@atc.tcs.com> | 2016-09-08 20:13:40 +0530 |
---|---|---|
committer | Sitaram Chamarty <sitaram@atc.tcs.com> | 2016-09-08 21:42:08 +0530 |
commit | b79494923b6f7780a8409472da5ce01897846518 (patch) | |
tree | 927136bfe7bab19ebe538fef63bb8bdfbe09d04a | |
parent | minor README change (diff) | |
download | gitolite-gentoo-b79494923b6f7780a8409472da5ce01897846518.tar.gz gitolite-gentoo-b79494923b6f7780a8409472da5ce01897846518.tar.bz2 gitolite-gentoo-b79494923b6f7780a8409472da5ce01897846518.zip |
fix 'access' command behaviour for 'C' and 'D' perms
Thanks to Alexander Groß for catching this. Basically, the access command was
ignoring the presence or absence
-rwxr-xr-x | src/commands/access | 11 | ||||
-rwxr-xr-x | t/access.t | 17 |
2 files changed, 25 insertions, 3 deletions
diff --git a/src/commands/access b/src/commands/access index 4209b7e..f02e533 100755 --- a/src/commands/access +++ b/src/commands/access @@ -57,7 +57,7 @@ my $ret = ''; if ( $repo ne '%' and $user ne '%' ) { # single repo, single user; no STDIN - $ret = access( $repo, $user, $aa, $ref ); + $ret = access( $repo, $user, adjust_aa($repo, $aa), $ref ); show($ret) if $s; @@ -79,10 +79,17 @@ while (<>) { my @in = split; my $r = $repo || shift @in; my $u = $user || shift @in; - $ret = access( $r, $u, $aa, $ref ); + $ret = access( $r, $u, adjust_aa($r, $aa), $ref ); print "$r\t$u\t$ret\n"; } +sub adjust_aa { + my ($repo, $aa) = @_; + $aa = '+' if $aa eq 'C' and not option($repo, 'CREATE_IS_C'); + $aa = '+' if $aa eq 'D' and not option($repo, 'DELETE_IS_D'); + return $aa; +} + sub show { my $ret = shift; die "repo already exists; ^C won't work\n" if $ret =~ /DENIED by existence/; @@ -9,7 +9,7 @@ use Gitolite::Test; # test 'gitolite access' # ---------------------------------------------------------------------- -try "plan 208"; +try "plan 216"; confreset;confadd ' @admins = admin dev1 @@ -162,6 +162,12 @@ confreset;confadd ' repo @all R = gitweb + + repo c0 + RW+ = @all + repo c1 + RWC = u1 + RW+ = @all '; try "ADMIN_PUSH set4; !/FATAL/" or die text(); @@ -184,4 +190,13 @@ try " gitolite access foo u3 R; ok gitolite access foo u4 R; !ok gitolite access foo gitweb R; ok + + gitolite access c0 u1 +; ok + gitolite access c0 u1 C; ok + gitolite access c0 u2 +; ok + gitolite access c0 u2 C; ok + gitolite access c1 u1 +; ok + gitolite access c1 u1 C; ok + gitolite access c1 u2 +; ok + gitolite access c1 u2 C; !ok "; |