]> oss.titaniummirror.com Git - repo_shell.git/blobdiff - gitweb.conf.addon
Some documentation on gitweb integration
[repo_shell.git] / gitweb.conf.addon
diff --git a/gitweb.conf.addon b/gitweb.conf.addon
new file mode 100644 (file)
index 0000000..f517d9e
--- /dev/null
@@ -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/;
+};