X-Git-Url: https://oss.titaniummirror.com/gitweb?a=blobdiff_plain;f=gitweb.conf.addon;fp=gitweb.conf.addon;h=f517d9e91bbf10277947dba6031a023638b98026;hb=bdafb792fd13b19c198cfd97908fde9b6dc5c29d;hp=0000000000000000000000000000000000000000;hpb=eefb116b6a88415e4a9e9a1d94f12781853df376;p=repo_shell.git diff --git a/gitweb.conf.addon b/gitweb.conf.addon new file mode 100644 index 0000000..f517d9e --- /dev/null +++ b/gitweb.conf.addon @@ -0,0 +1,13 @@ +# Add this to the bottom of your /etc/gitweb.conf file. +# When the web server can provide an authenticated remote_user, this function +# will ensure that user sees only those git repositories for which they have +# read permission according to {git_root}/.gitacls. + +$username = $cgi->remote_user; +$export_auth_hook = sub { + chomp($root = `grep git_root /etc/repo_shell.conf 2>/dev/null`); + $root =~ s|^[^=]*=\s*(.*)$|\1|; + $root =~ s|^(.*)/$|\1|; + $_[0] =~ s|^$root/(.*)|\1|; + return `repo_shell -t "$username" "$_[0]"` =~ /r/; +};