From 1c786d880a4c813139701fabbaeaf044f6077ed8 Mon Sep 17 00:00:00 2001 From: Sitaram Chamarty Date: Wed, 25 Nov 2009 08:46:21 +0530 Subject: [PATCH] doc/3: $repo_base -> $projectroot; honor @all in perm check - it appears that what we call $repo_base, gitweb already needs as $projectroot - allow read of repos defined as readable by @all plus some minor declaration changes to make the sample code work as is (thanks to teemu dot matilainen at iki dot fi) --- doc/3-faq-tips-etc.mkd | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/doc/3-faq-tips-etc.mkd b/doc/3-faq-tips-etc.mkd index 05eb8b7..5dcd935 100644 --- a/doc/3-faq-tips-etc.mkd +++ b/doc/3-faq-tips-etc.mkd @@ -267,11 +267,13 @@ already done and we just use it! # completely untested... but the basic idea should work fine # change these as needed - $repo_base = '/home/git/repositories/'; - $gl_conf_compiled = '/home/git/.gitolite/conf/gitolite.conf-compiled.pm'; + # projectroot should be the same as gitolite's REPO_BASE, but converted to + # an absolute path + $projectroot = '/home/git/repositories/'; + my $gl_conf_compiled = '/home/git/.gitolite/conf/gitolite.conf-compiled.pm'; # I assume this gives us the HTTP auth username - $username = $cgi->remote_user; + my $username = $cgi->remote_user; # ---------- @@ -284,12 +286,13 @@ already done and we just use it! $export_auth_hook = sub { my $reponame = shift; # gitweb passes us the full repo path; so we strip the beginning... - $reponame =~ s/\Q$repo_base//; + $reponame =~ s/\Q$projectroot//; # ...and the end, to get the repo name as it is specified in gitolite conf $reponame =~ s/\.git$//; - return exists $repos{$reponame}{R}{$username}; - } + return exists $repos{$reponame}{R}{$username} + || exists $repos{$reponame}{R}{'@all'}; + }; [leho]: http://leho.kraav.com/news/2009/10/27/using-apache-authentication-with-gitweb-gitosis-repository-access-control/