aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar jesopo2020-01-30 11:50:57 +0000
committerGravatar jesopo2020-01-30 11:50:57 +0000
commitc9d07b6032f5aca3b0fcf8027507a64f2fb942f0 (patch)
treed0341e54a148a8f1df185c27156d9c58b3f0fda0
parentsupport different Config names (diff)
signature
make sure we always have a channel when require_mode/access is present
-rw-r--r--src/core_modules/channel_access.py4
-rw-r--r--src/core_modules/check_mode.py4
2 files changed, 6 insertions, 2 deletions
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):
diff --git a/src/core_modules/check_mode.py b/src/core_modules/check_mode.py
index bb4cb3a9..a320af8d 100644
--- a/src/core_modules/check_mode.py
+++ b/src/core_modules/check_mode.py
@@ -13,7 +13,7 @@ LOWHIGH = {
"Set which channel mode is considered to be 'high' access", example="o"))
class Module(ModuleManager.BaseModule):
def _check_command(self, event, channel, require_mode):
- if channel and require_mode:
+ if channel:
if require_mode in LOWHIGH:
require_mode = channel.get_setting("mode-%s" % require_mode,
LOWHIGH[require_mode])
@@ -31,6 +31,8 @@ class Module(ModuleManager.BaseModule):
"You do not have permission to do this")
else:
return utils.consts.PERMISSION_FORCE_SUCCESS, None
+ else:
+ raise ValueError("_command_check requires a channel")
@utils.hook("preprocess.command")
def preprocess_command(self, event):