DAV svn
SVNParentPath e:/svn
# our access control policy
AuthzSVNAccessFile E:/usr/Apache2.2/bin/accesspolicy.conf
# try anonymous access first, resort to real
# authentication if necessary.
Satisfy Any
Require valid-user
# how to authenticate a user
AuthType Basic
AuthName "Subversion repository"
AuthUserFile E:/usr/Apache2.2/bin/passwd
AuthzSVNAccessFile 指向的是 authz 的策略文件,详细的权限控制可以在这个策略文件中指定。访问文件 accesspolicy.conf 的语法与svnserve.conf和 Apache 的配置文件非常相似,以(#)开头的行会被忽略;在它的简单形式里,每一小节命名一个版本库和一个里面的路径;认证用户名是在每个小节中的选项名;每个选项的值描述了用户访问版本库的级别:r(只读)或者rw(读写),如果用户没有提到或者值留空,访问是不允许的; * 表示所有用户,用它控制匿名用户的访问权限;@符号区分组和用户。如:
[groups]
committers = paulex, richard
developers = jimmy, michel, spark, sean
[/]
* = r
@committers = rw
[/branches/dev]
@developers = rw
[/tags]
tony = rw
[/private]
* =
@committers= r
使用 SVNParentPath 代替 SVNPath 来指定多个版本库的父目录时,其中所有的版本库都将按照这个策略文件配置。例如上例中 tony 将对所有版本库里的 /tags 目录具有读写权限。如果要对具体每个版本库配置,用如下的语法:
[groups]
project1_committers = paulex, richard
project2_committers = jimmy, michel, spark, tony, Robert
[repos1:/]
* = r
@ project1_committer = rw
[repos2:/]
* = r
@ project2_committer = rw
这样 repos1的 project1_committer 组只能对 repos1 版本库下的文件具有写权限而不能修改版本库 repos2 ,同样 repos2 的 project2_commiter 组也不能修改 repos1 版本库的文件。
FAQ:
1、路径或权限不足时将出现错误信息提示:
http://localhost (路径不对)
Error * PROPFIND request failed on '/' PROPFIND of '/': 200 OK (http://localhost)
http://localhost/svn (权限不足)
Error * PROPFIND request failed on '/svn' PROPFIND of '/svn': 403 Forbidden (http://localhost)
http://localhost/svn/repos (正常显示)
http://localhost/repos (权限不允许)
Error * PROPFIND request failed on '/repos' PROPFIND of '/repos': 405 Method Not Allowed (http://localhost)
2、不启动E:\subversion\bin\svnserve.exe ,但启动了ApacheSVN ,访问(tortoiseSVN –> Repo – browser)或提交(SVN Commit)情形如下:
现象:svn://localhost/svn/repos 不能访问或提交,提示:Error * Can't connect to host 'localhost': 由于目标机器积极拒绝,无法连接。 但 file:///e:/svn/repos 和 http://localhost/svn/repos 可以访问或提交。
原因:svn:// 是独立服务器 svnserver 自己的协议。file:/// 是本地访问,即服务器端和客户端在一个机器上。