Updated apply conditions to handle more firewall rules
This commit is contained in:
@@ -49,8 +49,12 @@ def applyConditions(definition, dictionary, outputs):
|
||||
return True, filter
|
||||
|
||||
if filter["operator"] == "in":
|
||||
if filter["filterkey"] == "called_dictionary":
|
||||
if filtervalue in dictionary:
|
||||
return True, filter
|
||||
else:
|
||||
if filtervalue in dictionary.get(filter["filterkey"], {}):
|
||||
return True, filter
|
||||
|
||||
if filter["operator"] == "is":
|
||||
if resolvedvalue is filtervalue:
|
||||
|
||||
@@ -20,15 +20,6 @@ def buildFirewall(listener, outputs):
|
||||
logging.info(f"Returning status_code: {status_code}")
|
||||
continue
|
||||
|
||||
#This needs to be moved into definitions but until logic is put in place it lives here.
|
||||
if "com.loxthelion.rmass_message_id" in item.get("content", {}):
|
||||
status_code = 200
|
||||
if firewall_log:
|
||||
logging.info("Excluding previously imported items")
|
||||
logging.info(f"Returning status_code: {status_code}")
|
||||
|
||||
continue
|
||||
|
||||
outputs["firewall_allowed"].append(item)
|
||||
|
||||
if outputs["firewall_allowed"] != []:
|
||||
|
||||
@@ -20,7 +20,7 @@ execute = rmassmessagepush
|
||||
|
||||
filters = [
|
||||
{
|
||||
"filterkey": "event",
|
||||
"filterkey": "called_dictionary",
|
||||
"operator": "in",
|
||||
"filtervalue": "state_key",
|
||||
"print": "Excluding state.key event",
|
||||
@@ -40,6 +40,13 @@ filters = [
|
||||
"print": "Excluding non-room message event",
|
||||
"status_code": 200,
|
||||
},
|
||||
{
|
||||
"filterkey": "content",
|
||||
"operator": "in",
|
||||
"filtervalue": "com.loxthelion.rmass_message_id",
|
||||
"print": "Excluding imported message loop item",
|
||||
"status_code": 200,
|
||||
},
|
||||
|
||||
]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user