Modify how permissions are checked
This commit is contained in:
parent
b6211748a1
commit
dcc23ce554
@ -111,6 +111,24 @@ class cmd:
|
||||
|
||||
return self.func(*largs) # don't check restrictions for role commands
|
||||
|
||||
if self.owner_only:
|
||||
if var.is_owner(nick, cloak):
|
||||
adminlog(chan, rawnick, self.name, rest)
|
||||
return self.func(*largs)
|
||||
|
||||
if chan == nick:
|
||||
pm(cli, nick, "You are not the owner.")
|
||||
else:
|
||||
cli.notice(nick, "You are not the owner.")
|
||||
return
|
||||
|
||||
if not self.admin_only:
|
||||
return self.func(*largs)
|
||||
|
||||
if var.is_admin(nick, cloak):
|
||||
adminlog(chan, rawnick, self.name, rest)
|
||||
return self.func(*largs)
|
||||
|
||||
if acc:
|
||||
for pattern in var.DENY_ACCOUNTS:
|
||||
if fnmatch.fnmatch(acc.lower(), pattern.lower()):
|
||||
@ -126,7 +144,6 @@ class cmd:
|
||||
if fnmatch.fnmatch(acc.lower(), pattern.lower()):
|
||||
for command in self.cmds:
|
||||
if command in var.ALLOW_ACCOUNTS[pattern]:
|
||||
if self.admin_only or self.owner_only:
|
||||
adminlog(chan, rawnick, self.name, rest)
|
||||
return self.func(*largs)
|
||||
|
||||
@ -145,23 +162,6 @@ class cmd:
|
||||
if fnmatch.fnmatch(cloak.lower(), pattern.lower()):
|
||||
for command in self.cmds:
|
||||
if command in var.ALLOW[pattern]:
|
||||
if self.admin_only or self.owner_only:
|
||||
adminlog(chan, rawnick, self.name, rest)
|
||||
return self.func(*largs)
|
||||
|
||||
if self.owner_only:
|
||||
if var.is_owner(nick, cloak):
|
||||
adminlog(chan, rawnick, self.name, rest)
|
||||
return self.func(*largs)
|
||||
|
||||
if chan == nick:
|
||||
pm(cli, nick, "You are not the owner.")
|
||||
else:
|
||||
cli.notice(nick, "You are not the owner.")
|
||||
return
|
||||
|
||||
if self.admin_only:
|
||||
if var.is_admin(nick, cloak):
|
||||
adminlog(chan, rawnick, self.name, rest)
|
||||
return self.func(*largs)
|
||||
|
||||
@ -171,8 +171,6 @@ class cmd:
|
||||
cli.notice(nick, "You are not an admin.")
|
||||
return
|
||||
|
||||
return self.func(*largs)
|
||||
|
||||
class hook:
|
||||
def __init__(self, name, hookid=-1):
|
||||
self.name = name
|
||||
|
Loading…
Reference in New Issue
Block a user