hgext/acl.py
changeset 15207 0f7f9f06c759
parent 12778 dce09f82f619
child 16499 0b463f52b948
equal deleted inserted replaced
15206:f85c76b16f27 15207:0f7f9f06c759
   213         if url[0] == 'remote' and url[1].startswith('http'):
   213         if url[0] == 'remote' and url[1].startswith('http'):
   214             user = urllib.unquote(url[3])
   214             user = urllib.unquote(url[3])
   215 
   215 
   216     if user is None:
   216     if user is None:
   217         user = getpass.getuser()
   217         user = getpass.getuser()
       
   218 
       
   219     ui.debug('acl: checking access for user "%s"\n' % user)
   218 
   220 
   219     cfg = ui.config('acl', 'config')
   221     cfg = ui.config('acl', 'config')
   220     if cfg:
   222     if cfg:
   221         ui.readconfig(cfg, sections = ['acl.groups', 'acl.allow.branches',
   223         ui.readconfig(cfg, sections = ['acl.groups', 'acl.allow.branches',
   222         'acl.deny.branches', 'acl.allow', 'acl.deny'])
   224         'acl.deny.branches', 'acl.allow', 'acl.deny'])
   240         ui.debug('acl: branch access granted: "%s" on branch "%s"\n'
   242         ui.debug('acl: branch access granted: "%s" on branch "%s"\n'
   241         % (ctx, branch))
   243         % (ctx, branch))
   242 
   244 
   243         for f in ctx.files():
   245         for f in ctx.files():
   244             if deny and deny(f):
   246             if deny and deny(f):
   245                 ui.debug('acl: user %s denied on %s\n' % (user, f))
   247                 raise util.Abort(_('acl: user "%s" denied on "%s"'
   246                 raise util.Abort(_('acl: access denied for changeset %s') % ctx)
   248                 ' (changeset "%s")') % (user, f, ctx))
   247             if allow and not allow(f):
   249             if allow and not allow(f):
   248                 ui.debug('acl: user %s not allowed on %s\n' % (user, f))
   250                 raise util.Abort(_('acl: user "%s" not allowed on "%s"'
   249                 raise util.Abort(_('acl: access denied for changeset %s') % ctx)
   251                 ' (changeset "%s")') % (user, f, ctx))
   250         ui.debug('acl: allowing changeset %s\n' % ctx)
   252         ui.debug('acl: path access granted: "%s"\n' % ctx)