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

时间:2009-11-11 12:16:01

标签: 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

然后我创建了两个mercurial A 存储库克隆。 Windows计算机上的 X Y

X .hg / hgrc文件是:

[ui]
username = clone1

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".

请建议我如何配置。

谢谢,

普利文

1 个答案:

答案 0 :(得分:5)

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

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

您在示例中使用的用户名('clone1'和'clone2')也需要由真实的身份验证系统支持。内置的hg-serve没有提供一个,所以你需要使用带有hgweb或hgwebdir的ssh或Apache / ISS。请参阅publishing repositories wiki page以获得精彩的概述。