CVSNT增加用户权限管理

来源:互联网 发布:苹果手机连接软件 编辑:程序博客网 时间:2024/05/16 14:31

                       源自:http://www.shengfang.org/blog/index.php?job=art&articleid=a_20050831_151144
bird 问:我使用CVSNT在代码库目录设置了访问权限,某些人只有底层几个目录的读写权限;在客户端用TortoiseCVS得要一个一个的取出,而且取出路径非常复杂,也不能一起更新;不知道你有没有碰到类似的问题,有没有方法解决??急等。。
我回答:我一般没有分配权限,因为我遵循XP开发,我查了一些资料,这个基本上没有办法。不过一般我都会分目录更新,这样提交比较明细一些。
bird 回答:3ks,我觉得他应该向phpgacl判断角色权限一样,递归到最底层再返回结果,而不是碰到被拒绝就over了。
我回答:我也是觉得这么比较正常,下午我会实验一下,看看有没有什么办法~
下午初步实验了一下,发现网上流传的资料好像不能生效
引用


4、  设置CVSROOT的权限
a)        cvs co CVSROOT
b)        cd CVSROOT
c)        cvs chacl default:n,缺省所有人都没有权限
d)        cvs chacl hutiejun:rwc,给管理员添加所有权限
e)         cvs chown hutiejun,所有者改成管理员

三、设置权限
cvs chacl
Usage: cvs chacl -R [-r tag] { user&line;default }:[{ [r][w][c]&line;[n] }] [directory...]
        -R     Recursively set permissions
        -r      Set permissions on specific branch
 



 如果没有进入CVS取出的目录
c:/3> cvs chacl default:n
cvs chacl: in directory .:
cvs [chacl aborted]: there is no version here; do 'cvs checkout' first
进入后:
c:/3/4> cvs chacl default:n
cvs [server aborted]: Couldn't open RCS file /cvstest/4/default:n,v: Invalid argument

CVSNT的帮助
Set a user's permissions for a directory
cvs chacl [-R] [-r branch] [-u user] [-j branch] [-n] [-p priority] [-m essage] [-a [no]{ read&line;write&line;create&line;tag&line;control }[,...]] [-d] [file or directory. .]
Requires: repository, directories
Changes: access control within file attributes
Allows the owner of a directory to control access by other users.

最后总结了一个步骤,首先我是使用的WINDOWS用户认证,直接使用CVS,没有使用TCVS/WINCVS

c:/>set cvsroot=:pserver:administrator at 127 dot 0.0.1:/cvstest 设置CVSROOT

c:/>cvs login   登录
Logging in to :pserver:administrator at 127 dot 0.0.1:2401:/cvstest
CVS password: **********

c:/>cvs passwd -r administrator -a admin  加一个超级用户
Adding user admin at 127 dot 0.0.1
New password: ***
Verify password: ***

修改CVSROOT目录下的:
checkoutlist文件,加入“ admin err-admin”
新建admin文件,加入admin
修改config文件:
# Set this to 'no' if pserver shouldn't check system users/passwords
#SystemAuth=yes
SystemAuth=no

然后以admin登录
c:/>set cvsroot=:pserver:admin at 127 dot 0.0.1:/cvstest

c:/>cvs login
Logging in to :pserver:admin at 127 dot 0.0.1:2401:/cvstest
CVS password: *** 改为超级用户登录

c:/>cvs passwd -a sf1  增加用户,还是必须映射一个系统用户?
Adding user sf1 at 127 dot 0.0.1
New password: ***
Verify password: ***
cvs server: *WARNING* CVS user 'sf1' will not be able to log in until they are aliased to a valid system user.

c:/>cvs passwd -r shengfang -a sf1
Adding user sf1 at 127 dot 0.0.1
New password: ***
Verify password: ***

c:/>cvs passwd -r shengfang -a sf2
Adding user sf2 at 127 dot 0.0.1
New password: ***
Verify password: ***

在cvsroot目录下创建文件fileattr.xml
如K:/cvstest/4/CVS
<?xml version="1.0" encoding="UTF-8"?>
<fileattr>
 <directory> 
  <acl user="Admin">
   <read />
   <write />
   <create />
  </acl>
  <acl>
   <read  deny="1" />
   <write deny="1" />
   <create deny="1" />
  </acl>
</directory>
</fileattr>

再在K:/cvstest/4/sf1/CVS创建
<?xml version="1.0" encoding="UTF-8"?>
<fileattr> 
 <directory>
  <acl user="Admin">
   <read />
   <write />
   <create />
  </acl>
 <acl user="sf1">
  <read />
  <write />
  <create />
 </acl>
 <acl>
  <read deny="1" />
  <write deny="1" />
  <create deny="1" />
 </acl>
</directory>
</fileattr>  

改为sf1登录
c:/3>set cvsroot=:pserver:sf1 at 127 dot 0.0.1:/cvstest

c:/3>cvs  login
Logging in to :pserver:sf1 at 127 dot 0.0.1:2401:/cvstest
CVS password: ***

c:/3>cvs co 4
cvs server: User sf1 cannot read 4

再改为ADMIN登录
c:/3/4>set cvsroot=:pserver:admin at 127 dot 0.0.1:/cvstest

c:/3/4>cvs login
Logging in to :pserver:admin at 127 dot 0.0.1:2401:/cvstest
CVS password: ***

c:/3/4>cd ..

c:/3>cvs co 4
cvs server: Updating 4
cvs server: Updating 4/sf1
cvs server: Updating 4/sf11
cvs server: Updating 4/sf2

看来是没有办法递归了,它好像是直接中断的,如果碰到没有权限的就退出,如果实在觉得麻烦,可能需要在WINCVS里面用TCL或者Python制作脚本、宏了

WINCVS和CVSNT的CVS.EXE文件经常会出现版本不对之类的错误 cvs [chacl aborted]: server does not support chacl

所以最好指定CVS程序为CVSNT自带的 N:/share/WinCvs/cvsnt/cvs.exe

原创粉丝点击