aboutsummaryrefslogtreecommitdiff
path: root/modules/permissions
diff options
context:
space:
mode:
authorGravatar jesopo2019-09-26 12:14:55 +0100
committerGravatar jesopo2019-09-26 12:14:55 +0100
commit2e80b223de84d93716baae2ba0ea1a0ec7070686 (patch)
tree711b48e0877707322f504d73e72220acee62a34d /modules/permissions
parent!echo should have a min_args kwarg (diff)
signature
allow all preprocess.command and check.command failures to have a message
Diffstat (limited to 'modules/permissions')
-rw-r--r--modules/permissions/__init__.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/modules/permissions/__init__.py b/modules/permissions/__init__.py
index ce259319..e36b51ad 100644
--- a/modules/permissions/__init__.py
+++ b/modules/permissions/__init__.py
@@ -192,7 +192,7 @@ class Module(ModuleManager.BaseModule):
def _check_command(self, event, permission, authenticated):
if event["user"].admin_master:
- return utils.consts.PERMISSION_FORCE_SUCCESS
+ return utils.consts.PERMISSION_FORCE_SUCCESS, None
identity_mechanism = event["server"].get_setting("identity-mechanism",
"internal")
@@ -213,18 +213,21 @@ class Module(ModuleManager.BaseModule):
has_permission = permission and (
permission in permissions or "*" in permissions)
if not identified_account or not has_permission:
- return "You do not have permission to do that"
+ return (utils.consts.PERMISSION_ERROR,
+ "You do not have permission to do that")
else:
- return utils.consts.PERMISSION_FORCE_SUCCESS
+ return utils.consts.PERMISSION_FORCE_SUCCESS, None
elif authenticated:
if not identified_account:
+ error = None
if identity_mechanism == "internal":
- return REQUIRES_IDENTIFY_INTERNAL % (
+ error = REQUIRES_IDENTIFY_INTERNAL % (
event["server"].nickname, event["server"].nickname)
else:
- return REQUIRES_IDENTIFY
+ error = REQUIRES_IDENTIFY
+ return utils.consts.PERMISSION_ERROR, error
else:
- return utils.consts.PERMISSION_FORCE_SUCCESS
+ return utils.consts.PERMISSION_FORCE_SUCCESS, None
@utils.hook("preprocess.command")
def preprocess_command(self, event):