Hiding some directories
Jonathan Noack
noackjr at alumni.rice.edu
Wed Jan 11 20:33:38 PST 2006
Manuel Lemos wrote:
> on 01/11/2006 06:35 PM Jerry.Nairn at microchip.com said the following:
> >> Is there a way to hide some directories besides CVSROOT?
> >
> > See the @ForbiddenFiles array in cvsweb.conf.
>
> Thanks, that is what I am looking for.
>
> BTW, I am not familiar enough with Perl. Although I was able to
> configure that array to forbid all directories that I did not want, I
> wonder if is there a way to specify in that array just a few top level
> directories that I want.
How about an @AllowedFiles list that only displays files and directories
that match? See attached patches for cvsweb.cgi and cvsweb.conf.
-Jonathan
-------------- next part --------------
--- cvsweb.cgi.old Wed Jan 11 22:12:42 2006
+++ cvsweb.cgi Wed Jan 11 23:15:30 2006
@@ -82,7 +82,7 @@
$allow_log_extra $allow_dir_extra $allow_source_extra
$allow_cvsgraph $cvsgraph_config $use_java_script $edit_option_form
$show_subdir_lastmod $show_log_in_markup $preformat_in_markup
- $tabstop $state $annTable $sel @ForbiddenFiles
+ $tabstop $state $annTable $sel @ForbiddenFiles @AllowedFiles
$use_descriptions %descriptions @mytz $dwhere
$use_moddate $gzip_open $file_list_len
$allow_tar @tar_options @gzip_options @zip_options @cvs_options
@@ -4339,7 +4339,10 @@
#
-# See if a file/dir is listed in the config file's @ForbiddenFiles list.
+# If a file/dir is listed in the config file's @ForbiddenFiles list,
+# forbid access to it. If the @AllowedFiles list is defined in the config
+# file then a file/dir must be listed for access to be granted.
+# @ForbiddenFiles takes precedence over @AllowedFiles.
# Takes a full file system path or one relative to $cvsroot, and strips the
# trailing ",v" if present, then compares. Returns 1 if forbidden, else 0.
#
@@ -4349,6 +4352,12 @@
$path =~ s|^$cvsroot/+||;
for my $forbidden_re (@ForbiddenFiles) {
return 1 if ($path =~ $forbidden_re);
+ }
+ if (($cvsroot ne $path) && (defined(@AllowedFiles))) {
+ for my $allowed_re (@AllowedFiles) {
+ return 0 if ($path =~ $allowed_re);
+ }
+ return 1;
}
return 0;
}
-------------- next part --------------
--- cvsweb.conf.dist Thu Dec 1 23:10:10 2005
+++ cvsweb.conf Wed Jan 11 23:24:16 2006
@@ -266,6 +266,17 @@
#qr|^my/+secret/+dir|o,
);
+# Regular expressions for files and directories which should be shown.
+# Each regexp is compared against a path relative to a CVS root, after
+# stripping the trailing ",v" if present. Only matching files and
+# directories are displayed.
+# @ForbiddenFiles takes precedence over @AllowedFiles.
+# If @AllowedFiles is not defined, only @ForbiddenFiles is enforced.
+#
+#@AllowedFiles = (
+ #qr|^my/+public/+dir|o,
+#);
+
# Use CVSROOT/descriptions for describing the directories/modules?
# See INSTALL, section 9.
#
More information about the freebsd-cvsweb
mailing list