diff options
author | Sitaram Chamarty <sitaram@atc.tcs.com> | 2012-04-23 06:22:03 +0530 |
---|---|---|
committer | Sitaram Chamarty <sitaram@atc.tcs.com> | 2012-04-23 17:27:00 +0530 |
commit | d74f596e231fe349961466dc2f00bfc931f88312 (patch) | |
tree | c0269a33ed58edb509b6b83b2983154e78b2b56e /src | |
parent | POST_CREATE efficiency... (please read below if you care) (diff) | |
download | gitolite-gentoo-d74f596e231fe349961466dc2f00bfc931f88312.tar.gz gitolite-gentoo-d74f596e231fe349961466dc2f00bfc931f88312.tar.bz2 gitolite-gentoo-d74f596e231fe349961466dc2f00bfc931f88312.zip |
make can_write() in Easy.pm more flexible
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/Gitolite/Easy.pm | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/Gitolite/Easy.pm b/src/lib/Gitolite/Easy.pm index 280a924..9231d00 100644 --- a/src/lib/Gitolite/Easy.pm +++ b/src/lib/Gitolite/Easy.pm @@ -112,14 +112,18 @@ sub can_read { } # can_write() -# return true if $ENV{GL_USER} is set and can write to the given repo +# return true if $ENV{GL_USER} is set and can write to the given repo. +# Optional second argument can be '+' to check that instead of 'W'. Optional +# third argument can be a full ref name instead of 'any'. # shell equivalent # if gitolite access -q $REPONAME $GL_USER W; then ... sub can_write { valid_user(); - my $r = shift; - return not( access( $r, $user, 'W', 'any' ) =~ /DENIED/ ); + my ($r, $aa, $ref) = @_; + $aa ||= 'W'; + $ref ||= 'any'; + return not( access( $r, $user, $aa, $ref ) =~ /DENIED/ ); } # config() |