2009-11-11 49 views
0

有主Mercurial庫(一個)有2個文件夾「depot1」和「depot2」在Windows機器我如何配置ACL擴展多用戶訪問控制設置在Mercurial庫

以下配置中完成的。 hg/hgrc文件A回購。

[ui] 
username = praveen 

[extensions] 
hgext.acl= 

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

[acl] 
sources = serve push pull commit 

然後創建的水銀庫2個克隆。 X在Windows機器上

X .hg/hgrc文件ÿ是:

[ui] 
username = clone1 

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

請建議我怎麼這個配置是可能的。

感謝,

普利文

回答

5

不幸的是,你誤會在[ui]部分username做什麼。這是嚴格的客戶端設置,如果「如果服務器要求我輸入用戶名以進行身份​​驗證,我想發送」,那麼您在回購A,X和Y中的ui.username中所擁有的內容不會影響遠程用戶可以訪問/使用這些存儲庫。

相反,您需要使用Y和X存儲庫的.hg/hgrc文件中的[acl.allow][acl.deny]部分來爲它們指定訪問控制。

您在示例中使用的用戶名('clone1'和'clone2')需要真實身份驗證系統支持。內置的hg-serve不提供一個,所以你需要使用ssh或Apache/ISS與hgweb或hgwebdir。請參閱publishing repositories wiki page瞭解詳情。

+0

您可以請參閱任何有關如何配置汞金屬儲存庫[acl.allow]/[acl.deny]和[allow_push]的好文檔。 – praveen 2009-11-12 07:25:38

+2

AclExtension wiki頁面http://mercurial.selenic.com/wiki/AclExtension解釋了[acl.allow]和[acl.deny]。 但是,您需要了解的是,mercurial沒有自己的用戶數據庫。它使用您的(1)操作系統,(2)ssh authorized_keys或(3)HTTP Web服務器身份驗證領域的用戶系統。它使用的取決於你如何訪問mercurial(ssh或http)。 你使用ssh:URLs還是http:URLs?你在哪裏創建你的用戶帳戶? – 2009-11-12 17:39:08

+0

我在Windows機器上安裝了mercurial,並且當前使用hg serve發佈我的單個mercurial存儲庫。 克隆存儲庫(每個用戶在其本地Windows機器上都有一個克隆) – praveen 2009-11-13 10:32:35

相關問題