Added synapse notify to preexeccution filtering at the action level. Expanded filter metadata
This commit is contained in:
@@ -12,10 +12,13 @@ def buildAction (action, outputs, process):
|
||||
|
||||
if hasattr(action, "allowaction"):
|
||||
if not action.allowaction:
|
||||
return outputs, None
|
||||
return None
|
||||
|
||||
if match:
|
||||
return outputs, None
|
||||
if filter.get("execute", False):
|
||||
response, outputs = executeRequest(filter["execute"], outputs, resolved)
|
||||
|
||||
return None
|
||||
|
||||
response, outputs = executeRequest(action, outputs, resolved)
|
||||
|
||||
@@ -27,4 +30,4 @@ def buildAction (action, outputs, process):
|
||||
if action_log:
|
||||
logging.info(f"{action.name} completed")
|
||||
|
||||
return outputs, response
|
||||
return response
|
||||
|
||||
@@ -17,7 +17,12 @@ def applyConditions(definition, dictionary, outputs):
|
||||
if filtervalue is None:
|
||||
continue
|
||||
|
||||
resolvedvalue = dictionary.get(filter["filterkey"])
|
||||
if filter.get("filterkey_format", None):
|
||||
if filter["filterkey_format"] == "length":
|
||||
resolvedvalue = len(dictionary.get(filter["filterkey"]))
|
||||
|
||||
else:
|
||||
resolvedvalue = dictionary.get(filter["filterkey"])
|
||||
|
||||
if filter["operator"] == ">=":
|
||||
if int(resolvedvalue or 0) >= int(filtervalue):
|
||||
|
||||
@@ -88,6 +88,15 @@ outputs = {
|
||||
##Filter test against recursiveset
|
||||
|
||||
filters = [
|
||||
{
|
||||
"filterkey": "message_body",
|
||||
#"filterkey_lib": "outputs",
|
||||
"filterkey_format": "length",
|
||||
"execute": synapsenotify,
|
||||
"operator": "<",
|
||||
"filtervalue": 5,
|
||||
"print": f"Message body is less than 5 characters. Notifying with {synapsenotify.name}...",
|
||||
},
|
||||
{
|
||||
"filterkey": "msgtype",
|
||||
"operator": "==",
|
||||
|
||||
Reference in New Issue
Block a user