3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-27 13:09:23 +01:00

PyLinkNCWUtils: make the allowAuthed, allowOper options to is_oper no-ops

This commit is contained in:
James Lu 2018-06-11 23:55:19 -07:00
parent 18f108c328
commit 2ca9de2ea8

View File

@ -1245,19 +1245,20 @@ class PyLinkNetworkCoreWithUtils(PyLinkNetworkCore):
return self.get_friendly_name(sid) in ulines return self.get_friendly_name(sid) in ulines
def is_oper(self, uid, allowAuthed=True, allowOper=True): def is_oper(self, uid, **kwargs):
""" """
Returns whether the given user has operator status on PyLink. This can be achieved Returns whether the given user has operator status. For IRC, this checks usermode +o.
by either identifying to PyLink as admin (if allowAuthed is True),
or having user mode +o set (if allowOper is True). At least one of The allowAuthed and allowOper keyword arguments are deprecated since PyLink 2.0-alpha4.
allowAuthed or allowOper must be True for this to give any meaningful
results.
""" """
if uid in self.users: if 'allowAuthed' in kwargs or 'allowOper' in kwargs:
if allowOper and ("o", None) in self.users[uid].modes: log.warning('(%s) is_oper: the "allowAuthed" and "allowOper" options are deprecated as '
return True 'of PyLink 2.0-alpha4 and now imply False and True respectively. To check for'
elif allowAuthed and self.users[uid].account: 'PyLink account status, instead check the User.account attribute directly.',
return True self.name)
if uid in self.users and ("o", None) in self.users[uid].modes:
return True
return False return False
def match_host(self, glob, target, ip=True, realhost=True): def match_host(self, glob, target, ip=True, realhost=True):