access.py
changeset 21 59540181a4bb
parent 20 f4daa224dc7e
child 22 578555227599
--- a/access.py	Tue Apr 22 10:13:39 2008 +0100
+++ b/access.py	Tue Apr 22 10:20:47 2008 +0100
@@ -21,20 +21,20 @@
     def __init__(self, ui, repo):
         self.ui = ui
         self.repo = repo
-        self.repo_path = os.environ['HG_REPO_PATH']
-        self.user = os.environ['REMOTE_USER']
         self.rules = rules.Ruleset.readfile(os.environ['HG_ACCESS_RULES_FILE'])
+        self.rules.set(user = os.environ['REMOTE_USER'])
+        self.rules.set(repo = os.environ['HG_REPO_PATH'])
 
     def allow(self, node):
         '''return if access allowed, raise exception if not.'''
         ctx = self.repo.changectx(node)
         branch = ctx.branch()
-        if not self.rules.allow("write", user=self.user, repo=self.repo_path, branch=self.branch, file=None):
+        if not self.rules.allow("write", branch=self.branch, file=None):
             self.ui.debug(_('%s: user %s not allowed on branch %s\n') %
                 (__name__, self.user, branch))
             return False
         for f in ctx.files():
-            if not self.rules.allow("write", user=self.user, repo=self.repo_path, branch=self.branch, file=f):
+            if not self.rules.allow("write", branch=self.branch, file=f):
                 self.ui.debug(_('%s: user %s not allowed on %s\n') %
                               (__name__, self.user, f))
                 return False