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
|
return True, filter
|
||||||
|
|
||||||
if filter["operator"] == "in":
|
if filter["operator"] == "in":
|
||||||
|
if filter["filterkey"] == "called_dictionary":
|
||||||
if filtervalue in dictionary:
|
if filtervalue in dictionary:
|
||||||
return True, filter
|
return True, filter
|
||||||
|
else:
|
||||||
|
if filtervalue in dictionary.get(filter["filterkey"], {}):
|
||||||
|
return True, filter
|
||||||
|
|
||||||
if filter["operator"] == "is":
|
if filter["operator"] == "is":
|
||||||
if resolvedvalue is filtervalue:
|
if resolvedvalue is filtervalue:
|
||||||
|
|||||||
@@ -20,15 +20,6 @@ def buildFirewall(listener, outputs):
|
|||||||
logging.info(f"Returning status_code: {status_code}")
|
logging.info(f"Returning status_code: {status_code}")
|
||||||
continue
|
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)
|
outputs["firewall_allowed"].append(item)
|
||||||
|
|
||||||
if outputs["firewall_allowed"] != []:
|
if outputs["firewall_allowed"] != []:
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ execute = rmassmessagepush
|
|||||||
|
|
||||||
filters = [
|
filters = [
|
||||||
{
|
{
|
||||||
"filterkey": "event",
|
"filterkey": "called_dictionary",
|
||||||
"operator": "in",
|
"operator": "in",
|
||||||
"filtervalue": "state_key",
|
"filtervalue": "state_key",
|
||||||
"print": "Excluding state.key event",
|
"print": "Excluding state.key event",
|
||||||
@@ -40,6 +40,13 @@ filters = [
|
|||||||
"print": "Excluding non-room message event",
|
"print": "Excluding non-room message event",
|
||||||
"status_code": 200,
|
"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