comparison hgext/acl.py @ 51700:7f0cb9ee0534

Backout accidental publication of a large range of revisions I accidentally published 25e7f9dcad0f::bd1483fd7088, this is the inverse.
author Raphaël Gomès <rgomes@octobus.net>
date Tue, 23 Jul 2024 10:02:46 +0200
parents 493034cc3265
children ca7bde5dbafb
comparison
equal deleted inserted replaced
51699:bd1483fd7088 51700:7f0cb9ee0534
277 default=lambda: [b'serve'], 277 default=lambda: [b'serve'],
278 ) 278 )
279 279
280 280
281 def _getusers(ui, group): 281 def _getusers(ui, group):
282
282 # First, try to use group definition from section [acl.groups] 283 # First, try to use group definition from section [acl.groups]
283 hgrcusers = ui.configlist(b'acl.groups', group) 284 hgrcusers = ui.configlist(b'acl.groups', group)
284 if hgrcusers: 285 if hgrcusers:
285 return hgrcusers 286 return hgrcusers
286 287
291 except KeyError: 292 except KeyError:
292 raise error.Abort(_(b"group '%s' is undefined") % group) 293 raise error.Abort(_(b"group '%s' is undefined") % group)
293 294
294 295
295 def _usermatch(ui, user, usersorgroups): 296 def _usermatch(ui, user, usersorgroups):
297
296 if usersorgroups == b'*': 298 if usersorgroups == b'*':
297 return True 299 return True
298 300
299 for ug in usersorgroups.replace(b',', b' ').split(): 301 for ug in usersorgroups.replace(b',', b' ').split():
302
300 if ug.startswith(b'!'): 303 if ug.startswith(b'!'):
301 # Test for excluded user or group. Format: 304 # Test for excluded user or group. Format:
302 # if ug is a user name: !username 305 # if ug is a user name: !username
303 # if ug is a group name: !@groupname 306 # if ug is a group name: !@groupname
304 ug = ug[1:] 307 ug = ug[1:]
363 ui.setconfig(b'extensions', b'acl', b'', source=b'internal') 366 ui.setconfig(b'extensions', b'acl', b'', source=b'internal')
364 extensions.loadall(ui, [b'acl']) 367 extensions.loadall(ui, [b'acl'])
365 368
366 369
367 def hook(ui, repo, hooktype, node=None, source=None, **kwargs): 370 def hook(ui, repo, hooktype, node=None, source=None, **kwargs):
371
368 ensureenabled(ui) 372 ensureenabled(ui)
369 373
370 if hooktype not in [b'pretxnchangegroup', b'pretxncommit', b'prepushkey']: 374 if hooktype not in [b'pretxnchangegroup', b'pretxncommit', b'prepushkey']:
371 raise error.Abort( 375 raise error.Abort(
372 _( 376 _(