Compare commits
2 commits
Author | SHA1 | Date | |
---|---|---|---|
beefb8c73e | |||
2193a9ce62 |
1 changed files with 10 additions and 10 deletions
|
@ -36,7 +36,7 @@ class ConsumerNTFY(Plugin):
|
|||
try: allowed_list = self.config["allowed_regions"][region]
|
||||
except: return False
|
||||
|
||||
if len(allowed_list) == 0: return True
|
||||
if allowed_list is None: return True # Empty list
|
||||
if sender in allowed_list: return True
|
||||
|
||||
# Sender not allowed in region config
|
||||
|
@ -52,20 +52,20 @@ class ConsumerNTFY(Plugin):
|
|||
# Each command must have a state/territory designation and a message
|
||||
if len(tokens) < 2: return []
|
||||
# And we must have self.config["region_configs"]
|
||||
try: trashvariable = self.config["allowed_regions"][region]
|
||||
try: trashvariable = self.config["region_configs"]
|
||||
except: return []
|
||||
|
||||
configs = [] # To be returned
|
||||
|
||||
allowed = False
|
||||
if region != "__global__" and (self.validate_sender(region, evt.sender)):
|
||||
allowed = True # Also append __global__ conf automatically
|
||||
try: configs.append(self.config["region_configs"][region])
|
||||
except: trashvariable = None
|
||||
allowed_globally = self.validate_sender("__global__", evt.sender)
|
||||
allowed_region = self.validate_sender(region, evt.sender)
|
||||
|
||||
if allowed or (self.validate_sender("__global__", evt.sender)):
|
||||
try: configs.append(self.config["region_configs"]["__global__"])
|
||||
except: trashvariable = None
|
||||
# If user is allowed globally and/or for a region,
|
||||
# the plugin should process both the region and __global__ configs
|
||||
if allowed_globally or allowed_region:
|
||||
for i in ["__global__", region]:
|
||||
try: configs.append(self.config["region_configs"][i])
|
||||
except: trashvariable = None
|
||||
|
||||
return configs
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue