Make 'forbiddenre' significantly more powerful by allowing folks to

distinguish between file and directory paths.

* viewvc.conf.dist
  (forbiddenre): Update documentation to note that directory paths
    will contains trailing slashes, and provide a related example.

* lib/config.py
  (is_forbidden): If using the 'forbiddenre' option, test directory
    paths only after appending a trailing forward slash.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/branches/1.0.x@1817 8cb11bc2-c004-0410-86c3-e597b4017df7
remotes/tags/1.0.5
cmpilato 2008-02-25 20:47:24 +00:00
parent da5b54e95d
commit 1c613a947f
2 changed files with 6 additions and 1 deletions

View File

@ -235,6 +235,8 @@ class Config:
# Join the root and path-parts together into one path-like thing.
root_and_path = string.join([root] + path_parts, "/")
if pathtype == vclib.DIR:
root_and_path = root_and_path + '/'
# If we still have a list of strings, replace those suckers with
# lists of (compiled_regex, negation_flag)

View File

@ -201,7 +201,7 @@ forbidden =
# authorized to see the path "/trunk/www/index.html" in the repository
# whose root name is "svnrepos", this authorizer will test the path
# "svnrepos/trunk/www/index.html" against the list of forbidden regular
# expressions.
# expressions. Directory paths will be terminated by a forward slash.
#
# NOTE: Use of this configuration option will *disable* any configuration of
# the 'forbidden' option -- they cannot be used simultaneously.
@ -216,6 +216,9 @@ forbidden =
# forbiddenre = !^example1(/|$), !^example2(/|$)/
# forbiddenre = !^example[12](/|$)
#
# Only allow visibility of HTML files and the directories that hold them:
# forbiddenre = !^.*(/|\.html)$
#
forbiddenre =
#