2010-05-14 18:00:40 +02:00
|
|
|
# --------------------------------------------
|
|
|
|
# Per-repo authorization based on gitolite ACL
|
|
|
|
# Include this in gitweb.conf
|
|
|
|
# See doc/3-faq-tips-etc.mkd for more info
|
|
|
|
|
2011-01-29 12:35:31 +01:00
|
|
|
# please note that the author does not have personal experience with gitweb
|
|
|
|
# and does not use it. Some testing may be required. Patches welcome but
|
|
|
|
# please make sure they are tested against a "github" version of gitolite
|
|
|
|
# and not an RPM or a DEB, for obvious reasons.
|
|
|
|
|
2010-05-14 18:00:40 +02:00
|
|
|
# HOME of the gitolite user
|
2011-01-29 12:35:31 +01:00
|
|
|
my $gl_home = $ENV{HOME} = "/home/git";
|
2010-05-14 18:00:40 +02:00
|
|
|
|
2011-01-15 16:39:56 +01:00
|
|
|
# the following variables are needed by gitolite; please edit before using
|
|
|
|
|
|
|
|
# this should normally not be anything else
|
2010-05-14 18:00:40 +02:00
|
|
|
$ENV{GL_RC} = "$gl_home/.gitolite.rc";
|
2011-01-15 16:39:56 +01:00
|
|
|
# this can have different values depending on how you installed.
|
|
|
|
|
|
|
|
# if you used RPM/DEB or "root" methods it **might** be this:
|
|
|
|
$ENV{GL_BINDIR} = "/usr/local/bin";
|
|
|
|
# if you used the "non-root" method it **might** be this:
|
|
|
|
$ENV{GL_BINDIR} = "$gl_home/bin";
|
|
|
|
# If in doubt take a look at ~/.ssh/authorized_keys; at least one of the lines
|
|
|
|
# might contain something like:
|
|
|
|
# command="/home/git/.gitolite/src/gl-auth-command
|
|
|
|
# and you should use whatever directory the gl-auth-command is in (in this
|
|
|
|
# example /home/git/.gitolite.src)
|
|
|
|
|
|
|
|
# finally the user name
|
2010-05-27 19:47:06 +02:00
|
|
|
$ENV{GL_USER} = $cgi->remote_user || "gitweb";
|
2010-05-14 18:00:40 +02:00
|
|
|
|
2011-01-15 16:39:56 +01:00
|
|
|
# now get gitolite stuff in...
|
2011-01-29 12:35:31 +01:00
|
|
|
unshift @INC, $ENV{GL_BINDIR};
|
|
|
|
require gitolite_rc; gitolite_rc -> import;
|
|
|
|
require gitolite; gitolite -> import;
|
2010-05-14 18:00:40 +02:00
|
|
|
|
|
|
|
# set project root etc. absolute paths
|
|
|
|
$ENV{GL_REPO_BASE_ABS} = ( $REPO_BASE =~ m(^/) ? $REPO_BASE : "$gl_home/$REPO_BASE" );
|
|
|
|
$projects_list = $projectroot = $ENV{GL_REPO_BASE_ABS};
|
|
|
|
|
|
|
|
$export_auth_hook = sub {
|
|
|
|
my $repo = shift;
|
|
|
|
# gitweb passes us the full repo path; so we strip the beginning
|
|
|
|
# and the end, to get the repo name as it is specified in gitolite conf
|
|
|
|
return unless $repo =~ s/^\Q$projectroot\E\/?(.+)\.git$/$1/;
|
|
|
|
|
|
|
|
# check for (at least) "R" permission
|
|
|
|
my ($perm, $creator) = &repo_rights($repo);
|
|
|
|
return ($perm =~ /R/);
|
|
|
|
};
|