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)
This commit is contained in:
parent
ad6d46fab9
commit
1c786d880a
|
@ -267,11 +267,13 @@ already done and we just use it!
|
||||||
# completely untested... but the basic idea should work fine
|
# completely untested... but the basic idea should work fine
|
||||||
|
|
||||||
# change these as needed
|
# change these as needed
|
||||||
$repo_base = '/home/git/repositories/';
|
# projectroot should be the same as gitolite's REPO_BASE, but converted to
|
||||||
$gl_conf_compiled = '/home/git/.gitolite/conf/gitolite.conf-compiled.pm';
|
# 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
|
# 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 {
|
$export_auth_hook = sub {
|
||||||
my $reponame = shift;
|
my $reponame = shift;
|
||||||
# gitweb passes us the full repo path; so we strip the beginning...
|
# 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
|
# ...and the end, to get the repo name as it is specified in gitolite conf
|
||||||
$reponame =~ s/\.git$//;
|
$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/
|
[leho]: http://leho.kraav.com/news/2009/10/27/using-apache-authentication-with-gitweb-gitosis-repository-access-control/
|
||||||
|
|
Loading…
Reference in a new issue