如何在Mercurial存储库中通过acl扩展配置多个用户访问控制设置

pra*_*een 0 mercurial

我有一个主要的mercurial存储库(A),在Windows机器中有2个文件夹"depot1"和"depot2"

以下配置在A repo的.hg/hgrc文件中完成.

[ui]
username = praveen

[extensions]
hgext.acl=

[hooks]
changegroup.update = hg update
pretxnchangegroup.acl = python:hgext.acl.hook

[acl]
sources = serve push pull commit
Run Code Online (Sandbox Code Playgroud)

然后我创建了2个mercurial A库的克隆.Windows机器上的XY.

X .hg/hgrc文件是:

[ui]
username = clone1
Run Code Online (Sandbox Code Playgroud)

Y .hg/hgrc文件是:

[ui]
username = clone2

My Question: 
1- Restrict all push operations from user="clone2".
2- user="clone1" will be able to perform push on only "depot1".
Run Code Online (Sandbox Code Playgroud)

请建议我如何配置这种配置.

谢谢,

普利文

Ry4*_*ase 5

不幸的是,你误解了username[ui]部分的内容.它严格地是一个客户端设置,上面写着"如果服务器要求我提供用于身份验证的用户名,那就是我要发送的内容",那么你ui.username在repos A,X和Y中所拥有的内容对于什么是远程用户都没有影响可以和这些存储库一起使用.

相反,您需要使用Y和X存储库文件中的[acl.allow][acl.deny]部分.hg/hgrc来指定它们的访问控制.

您在示例中使用的用户名('clone1'和'clone2')也需要由真实的身份验证系统支持.内置的hg-serve不提供一个,所以你需要使用带有hgweb或hgwebdir的ssh或Apache/ISS.有关概述,请参阅发布存储库Wiki页面.

  • AclExtension维基页面http://mercurial.selenic.com/wiki/AclExtension解释了[acl.allow]和[acl.deny].但是,您需要了解的是,mercurial没有自己的用户数据库.它使用(1)操作系统,(2)ssh authorized_keys或(3)HTTP Web服务器认证领域的用户系统.它使用的那个取决于你如何访问mercurial(ssh或http).你使用ssh:URL或http:URL?您在哪里创建用户帐户? (2认同)