diff options
Diffstat (limited to 'modules/permissions')
| -rw-r--r-- | modules/permissions/__init__.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/modules/permissions/__init__.py b/modules/permissions/__init__.py index 3e2ce3f1..269f2a0f 100644 --- a/modules/permissions/__init__.py +++ b/modules/permissions/__init__.py @@ -191,14 +191,10 @@ class Module(ModuleManager.BaseModule): event["stdout"].write("Reset password for '%s'" % target.nickname) - @utils.hook("preprocess.command") - def preprocess_command(self, event): + def _check_command(self, event, permission, authenticated): if event["user"].admin_master: return utils.consts.PERMISSION_FORCE_SUCCESS - permission = event["hook"].get_kwarg("permission", None) - authenticated = event["hook"].kwargs.get("authenticated", False) - identity_mechanism = event["server"].get_setting("identity-mechanism", "internal") identified_account = None @@ -231,6 +227,16 @@ class Module(ModuleManager.BaseModule): else: return utils.consts.PERMISSION_FORCE_SUCCESS + @utils.hook("preprocess.command") + def preprocess_command(self, event): + permission = event["hook"].get_kwarg("permission", None) + authenticated = event["hook"].kwargs.get("authenticated", False) + return self._check_command(event, permission, authenticated) + + @utils.hook("check.command.permission") + def check_command(self, event): + return self._check_command(event, event["request_args"][0], False) + @utils.hook("received.command.mypermissions", authenticated=True) def my_permissions(self, event): """ |
