mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-01 01:09:22 +01:00
match_host: implicitly convert string masks such as "user1" to "$pylinkacc:user1"
This keeps it in line with other services packages and is way nicer to read.
This commit is contained in:
parent
8059f3f7fc
commit
e0e929492e
11
classes.py
11
classes.py
@ -1016,6 +1016,17 @@ class PyLinkNetworkCoreWithUtils(PyLinkNetworkCore):
|
||||
|
||||
# Prepare a list of hosts to check against.
|
||||
if target in self.users:
|
||||
|
||||
if not utils.isHostmask(glob):
|
||||
for specialchar in '$:()':
|
||||
# XXX: we should probably add proper rules on what's a valid account name
|
||||
if specialchar in glob:
|
||||
break
|
||||
else:
|
||||
# Implicitly convert matches for *sane* account names to "$pylinkacc:accountname".
|
||||
log.debug('(%s) Using target $pylinkacc:%s instead of raw string %r', self.name, glob, glob)
|
||||
glob = '$pylinkacc:' + glob
|
||||
|
||||
if glob.startswith('$'):
|
||||
# Exttargets start with $. Skip regular ban matching and find the matching ban handler.
|
||||
glob = glob.lstrip('$')
|
||||
|
@ -101,7 +101,7 @@ permissions:
|
||||
|
||||
# Replace ABC123 with your PyLink account name (configured above)
|
||||
# in order to give yourself admin access.
|
||||
"$pylinkacc:ABC123":
|
||||
"ABC123":
|
||||
- "*"
|
||||
|
||||
servers:
|
||||
|
Loading…
Reference in New Issue
Block a user