mirror of
https://github.com/jlu5/PyLink.git
synced 2025-02-24 17:30:51 +01:00
permissions: move admin login clause into checkPermissions()
This is more persistent.
This commit is contained in:
parent
53de6542f6
commit
e903a8226a
@ -7,7 +7,7 @@ import threading
|
|||||||
|
|
||||||
# Global variables: these store mappings of hostmasks/exttargets to lists of permissions each target has.
|
# Global variables: these store mappings of hostmasks/exttargets to lists of permissions each target has.
|
||||||
default_permissions = defaultdict(set)
|
default_permissions = defaultdict(set)
|
||||||
permissions = defaultdict(set, {'$pylinkacc': {'*'}})
|
permissions = defaultdict(set)
|
||||||
|
|
||||||
# Only allow one thread to change the permissions index at once.
|
# Only allow one thread to change the permissions index at once.
|
||||||
permissions_lock = threading.Lock()
|
permissions_lock = threading.Lock()
|
||||||
@ -58,6 +58,11 @@ def checkPermissions(irc, uid, perms, also_show=[]):
|
|||||||
Checks permissions of the caller. If the caller has any of the permissions listed in perms,
|
Checks permissions of the caller. If the caller has any of the permissions listed in perms,
|
||||||
this function returns True. Otherwise, NotAuthorizedError is raised.
|
this function returns True. Otherwise, NotAuthorizedError is raised.
|
||||||
"""
|
"""
|
||||||
|
# If the user is logged in, they automatically have all permissions.
|
||||||
|
if irc.matchHost('$pylinkacc', uid):
|
||||||
|
log.debug('permissions: overriding permissions check for admin user %s', irc.getHostmask(uid))
|
||||||
|
return True
|
||||||
|
|
||||||
# Iterate over all hostmask->permission list mappings.
|
# Iterate over all hostmask->permission list mappings.
|
||||||
for host, permlist in permissions.copy().items():
|
for host, permlist in permissions.copy().items():
|
||||||
log.debug('permissions: permlist for %s: %s', host, permlist)
|
log.debug('permissions: permlist for %s: %s', host, permlist)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user