Delete a user's 'access' channel setting when they have no permissions left

(channel_access.py)
This commit is contained in:
jesopo 2019-01-29 00:02:56 +00:00
parent 1b933e7c00
commit a3a535b195

View file

@ -57,6 +57,10 @@ class Module(ModuleManager.BaseModule):
raise utils.EventError("%s does not have '%s' permission" % raise utils.EventError("%s does not have '%s' permission" %
(target.nickname, acc)) (target.nickname, acc))
access.remove(acc) access.remove(acc)
event["target"].set_user_setting(target.get_id(), "access", access) if access:
event["target"].set_user_setting(target.get_id(), "access",
access)
else:
event["target"].del_user_setting(target.get_id(), "access")
event["stdout"].write("Removed permission from %s: %s" % ( event["stdout"].write("Removed permission from %s: %s" % (
target.nickname, " ".join(event["args_split"][2:]))) target.nickname, " ".join(event["args_split"][2:])))