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]
|
try: allowed_list = self.config["allowed_regions"][region]
|
||||||
except: return False
|
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
|
if sender in allowed_list: return True
|
||||||
|
|
||||||
# Sender not allowed in region config
|
# Sender not allowed in region config
|
||||||
|
@ -52,20 +52,20 @@ class ConsumerNTFY(Plugin):
|
||||||
# Each command must have a state/territory designation and a message
|
# Each command must have a state/territory designation and a message
|
||||||
if len(tokens) < 2: return []
|
if len(tokens) < 2: return []
|
||||||
# And we must have self.config["region_configs"]
|
# And we must have self.config["region_configs"]
|
||||||
try: trashvariable = self.config["allowed_regions"][region]
|
try: trashvariable = self.config["region_configs"]
|
||||||
except: return []
|
except: return []
|
||||||
|
|
||||||
configs = [] # To be returned
|
configs = [] # To be returned
|
||||||
|
|
||||||
allowed = False
|
allowed_globally = self.validate_sender("__global__", evt.sender)
|
||||||
if region != "__global__" and (self.validate_sender(region, evt.sender)):
|
allowed_region = self.validate_sender(region, evt.sender)
|
||||||
allowed = True # Also append __global__ conf automatically
|
|
||||||
try: configs.append(self.config["region_configs"][region])
|
|
||||||
except: trashvariable = None
|
|
||||||
|
|
||||||
if allowed or (self.validate_sender("__global__", evt.sender)):
|
# If user is allowed globally and/or for a region,
|
||||||
try: configs.append(self.config["region_configs"]["__global__"])
|
# the plugin should process both the region and __global__ configs
|
||||||
except: trashvariable = None
|
if allowed_globally or allowed_region:
|
||||||
|
for i in ["__global__", region]:
|
||||||
|
try: configs.append(self.config["region_configs"][i])
|
||||||
|
except: trashvariable = None
|
||||||
|
|
||||||
return configs
|
return configs
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue