From c9d07b6032f5aca3b0fcf8027507a64f2fb942f0 Mon Sep 17 00:00:00 2001 From: jesopo Date: Thu, 30 Jan 2020 11:50:57 +0000 Subject: make sure we always have a channel when require_mode/access is present --- src/core_modules/channel_access.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/core_modules/channel_access.py') diff --git a/src/core_modules/channel_access.py b/src/core_modules/channel_access.py index 809b4ced..d4a81d42 100644 --- a/src/core_modules/channel_access.py +++ b/src/core_modules/channel_access.py @@ -14,13 +14,15 @@ class Module(ModuleManager.BaseModule): return (require_access in access or "*" in access) and identified def _command_check(self, event, channel, require_access): - if channel and require_access: + if channel: if self._has_channel_access(channel, event["user"], require_access): return utils.consts.PERMISSION_FORCE_SUCCESS, None else: return (utils.consts.PERMISSION_ERROR, "You do not have permission to do this") + else: + raise ValueError("_command_check requires a channel") @utils.hook("preprocess.command") def preprocess_command(self, event): -- cgit v1.3.1-10-gc9f91