免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2524 | 回复: 0

subversion 安装后的权限设置 [复制链接]

论坛徽章:
0
发表于 2011-03-04 13:41 |显示全部楼层
我的目标是使得用户:chenwei,fengdongwei,zhouwei,luowei,liuxin
有不同的权限, 于是按照手册上配置, 出现了错误, 主要的问题出在
手册上的配置是对于一个目录下有多个资料库, 但是我的svn目录下只有一个资料库,
所以设置上有些不同
下面是几个非常好的文章
http://study.pay500.com/2/s24508.htm
http://man.chinaunix.net/linux/d ... arning/ch09s14.html
另外debian.linuxsir.org 上的http://debian.linuxsir.org/main/?q=node/58
都是非常好的文章, 根据他们文章里面的配置, 下面是一个标准的配置文件
  1. # dav_svn.conf - Example Subversion/Apache configuration
  2. #
  3. # For details and further options see the Apache user manual.
  4. # <Location URL> ... </Location>
  5. # URL controls how the repository appears to the outside world.
  6. # In this example clients access the repository as http://hostname/svn/repos
  7. <Location /svn>
  8. # uncomment this to enable the repository
  9. DAV svn
  10. # set this to the path to your repository
  11. SVNParentPath /var/lib/svn
  12. SVNIndexXSLT "/svnindex.xsl"
  13. # The following allows for basic http authentication. Basic authentication
  14. # should not be considered secure for any particularly rigorous definition of
  15. # secure.
  16. # to create a passwd file
  17. # # rm -f /etc/apache2/dav_svn.passwd
  18. # # htpasswd2 -c /etc/apache2/dav_svn.passwd dwhedon
  19. # New password:
  20. # Re-type new password:
  21. # Adding password for user dwhedon
  22. # #
  23. # Uncomment the following 3 lines to enable Basic Authentication
  24. AuthType Basic
  25. AuthName "Subversion Repository"
  26. # AuthLDAPEnabled on
  27. # AuthLDAPURL ldap://localhost/ou=Users,dc=sczfcpa,dc=com?uid?one
  28. AuthUserFile /etc/apache2/dav_svn.passwd
  29. # Uncomment the following line to enable Authz Authentication
  30. AuthzSVNAccessFile /etc/apache2/dav_svn.authz
  31. # Uncomment the following three lines allow anonymous read, but make
  32. # committers authenticate themselves
  33. # <LimitExcept GET PROPFIND OPTIONS REPORT>
  34. Require valid-user
  35. # </LimitExcept>
  36. </Location>
复制代码
另外需要写权限文件, 可以参考
[groups] #定义组
admin=jims,ringkee
tests=tester1,tester2

[erp:/] #定义erp储存库根目录的访问权限
@admin=rw #admin组有读写权限
tests=r #test用户只有读权限

[oa:/test] #定义oa储存库下test目录的访问权限
*= #禁止所有用户访问,星号代表所有用户,权限为空代表没有任何权限
ringkee=rw #打开ringkee用户的读写权限注意,组用户的rw必须写成 @admin 前面有@
用户的rw没有@
另外, 由于是多个repo,所以权限文件里面的目录是上面那么写的,
: 前的代表了repo资料库的名称,
如果是单独的资料库, 那么就一定要没有: 和他前面的东西。

下面说我的一些经验, 我只有一个svn的repo~,所以配置不一样:
svn权限的安装
  1. <Location /svn>
  2. DAV svn
  3. SVNPath G:\svn\repository
  4. AuthType Basic
  5. AuthName "Subversion repository"
  6. AuthUserFile G:\svn\svn-auth-file

  7. #AuthzSVNAccessFile G:\svn\accessfile
  8. <LimitExcept GET PROPFIND OPTIONS REPORT>
  9. Require valid-user
  10. </LimitExcept>
  11. </Location>
复制代码
上面的代码可以实现验证用户的提交,但是没法做到按目录的管理
在accessfile里面
如果是多个respositor, 则写为[testmgr:/]这样的目录, 但是
如果上面用的SVNPath,只有一个res,那么必须写[/]这样的目录
而且 , 如果是rw权限的话, 必须使用@group=rw才可以
组用户是@admin=rw
用户是liuxin=rw
单个项目的话, 目录是这样的
[/testmgr/branches/]
以res的名称开头
郁闷!!

最后的配置文件是
  1. [groups]
  2. admin=root
  3. leader=chenwei
  4. dev=fengdongwei,zhouwei,luowei,liuxin

  5. [/testmgr/branches/fengdongwei]
  6. fengdongwei=rw
  7. [/testmgr/branches/zhouwei]
  8. zhouwei=rw
  9. [/testmgr/branches/luowei]
  10. luowei=rw
  11. [/testmgr/branches/liuxin]
  12. liuxin=rw

  13. [/testmgr]
  14. *=r
  15. @admin=rw
  16. @leader=rw
复制代码
几个比较重要的命令是
svnadmin create d:\svn\repository 在那个目录下建立repository档案库, 如果在这个目录D:\svn\下建立多个的话,就需要在上面的配置文件里面用SVNParentPath了, 现在svn目录下只有一个repo,就只能用SVNPath

svn import . http://localhost/svn -m "Initial repository layout" 导入一个目录
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP