access.py
changeset 19 62ee928ac9b3
parent 18 538d6b198f4a
child 23 9fa62cfd2821
equal deleted inserted replaced
18:538d6b198f4a 19:62ee928ac9b3
    11 from mercurial.i18n import _
    11 from mercurial.i18n import _
    12 from mercurial.node import *
    12 from mercurial.node import *
    13 from mercurial import util
    13 from mercurial import util
    14 
    14 
    15 import os
    15 import os
    16 import rules
    16 import ruleset
    17 
    17 
    18 class Checker(object):
    18 class Checker(object):
    19     '''acl checker.'''
    19     '''acl checker.'''
    20 
    20 
    21     def __init__(self, ui, repo):
    21     def __init__(self, ui, repo):
    22         self.ui = ui
    22         self.ui = ui
    23         self.repo = repo
    23         self.repo = repo
    24         self.repo_path = os.environ['HG_REPO_PATH']
    24         self.repo_path = os.environ['HG_REPO_PATH']
    25         self.user = os.environ['REMOTE_USER']
    25         self.user = os.environ['REMOTE_USER']
    26         self.rules = rules.Ruleset.readfile(os.environ['HG_ACCESS_RULES_FILE'])
    26         self.rules = ruleset.Ruleset.readfile(os.environ['HG_ACCESS_RULES_FILE'])
    27 
    27 
    28     def check(self, node):
    28     def check(self, node):
    29         '''return if access allowed, raise exception if not.'''
    29         '''return if access allowed, raise exception if not.'''
    30         files = self.repo.changectx(node).files()
    30         files = self.repo.changectx(node).files()
    31         for f in files:
    31         for f in files: