3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-24 11:42:51 +01:00

permissions: limit "login = admin access" to old-style (< 1.1) login blocks

This commit is contained in:
James Lu 2016-12-09 20:51:04 -08:00
parent 506467193e
commit 57aa844fcb

View File

@ -58,9 +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,
this function returns True. Otherwise, NotAuthorizedError is raised.
"""
# For old (< 1.1 login blocks):
# 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))
if irc.matchHost('$pylinkacc', uid) and conf.conf['login'].get('user'):
log.debug('permissions: overriding permissions check for old-style admin user %s',
irc.getHostmask(uid))
return True
# Iterate over all hostmask->permission list mappings.