Re-add botconfig.ADMINS and ADMINS_ACCOUNTS
Still considered legacy/backwards-compat code, so giving out +F flags should be preferred, but now wildcard admins are possible again.
This commit is contained in:
parent
1bf468224e
commit
16a0a28e36
@ -189,7 +189,7 @@ class cmd:
|
||||
return
|
||||
|
||||
flags = var.FLAGS[hostmask] + var.FLAGS_ACCS[acc]
|
||||
is_full_admin = "F" in flags
|
||||
is_full_admin = var.is_admin(nick, ident, host)
|
||||
if self.flag and (is_full_admin or is_owner):
|
||||
adminlog(chan, rawnick, self.name, rest)
|
||||
return self.func(*largs)
|
||||
|
@ -377,7 +377,27 @@ def is_admin(nick, ident=None, host=None, acc=None):
|
||||
acc = USERS[nick]["account"]
|
||||
hostmask = nick + "!" + ident + "@" + host
|
||||
flags = FLAGS[hostmask] + FLAGS_ACCS[acc]
|
||||
return "F" in flags
|
||||
|
||||
if not "F" in flags:
|
||||
try:
|
||||
hosts = set(botconfig.ADMINS)
|
||||
accounts = set(botconfig.ADMINS_ACCOUNTS)
|
||||
|
||||
if not DISABLE_ACCOUNTS and acc and acc != "*":
|
||||
for pattern in accounts:
|
||||
if fnmatch.fnmatch(acc.lower(), pattern.lower()):
|
||||
return True
|
||||
|
||||
if host:
|
||||
for hostmask in hosts:
|
||||
if match_hostmask(hostmask, nick, ident, host):
|
||||
return True
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
return is_owner(nick, ident, host, acc)
|
||||
|
||||
return True
|
||||
|
||||
def irc_lower(nick):
|
||||
mapping = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user