diff options
| author | 2018-11-10 22:32:44 +0000 | |
|---|---|---|
| committer | 2018-11-10 22:32:44 +0000 | |
| commit | dbe0d6cdab2e801d60d952a77be4183e29fd03c0 (patch) | |
| tree | 5b20ba109cf930f29f16bc7693ad45922389ab8c /modules/check_mode.py | |
| parent | Add basic access controls to modules/rest_api.py (diff) | |
| signature | ||
Treat "low"/"high" as synonymous with "v"/"o" but with a settable override in
modules/check_mode.py
Diffstat (limited to 'modules/check_mode.py')
| -rw-r--r-- | modules/check_mode.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/modules/check_mode.py b/modules/check_mode.py index f4922549..cdc1dc12 100644 --- a/modules/check_mode.py +++ b/modules/check_mode.py @@ -1,11 +1,23 @@ - from src import ModuleManager, utils +LOWHIGH = { + "low": "v", + "high": "o" +} +@utils.export("channelset", {"setting": "mode-low", + "help": "Set which channel mode is considered to be 'low' access") +@utils.export("channelset", {"setting": "mode-high", + "help": "Set which channel mode is considered to be 'high' access") class Module(ModuleManager.BaseModule): @utils.hook("preprocess.command") def preprocess_command(self, event): require_mode = event["hook"].get_kwarg("require_mode") if event["is_channel"] and require_mode: + if require_mode.lower() in LOWHIGH: + require_mode = event["target"].get_setting( + "mode-%s" % require_mode.lower(), + LOWHIGH[require_mode.lower()]) + if not event["target"].mode_or_above(event["user"], require_mode): return "You do not have permission to do this" |
