3
0

Support for manual/explicit running of user scripts

Moved user-script endponts under /automation/
Add permission checking for trigger running
This commit is contained in:
Denis Arh
2019-08-12 14:48:05 +02:00
parent 6463df9af1
commit ffdeef1da2
22 changed files with 895 additions and 298 deletions
+29 -23
View File
@@ -763,28 +763,6 @@
]
}
},
{
"name": "runScript",
"method": "POST",
"title": "Trigger a specific script on record",
"path": "/run-script",
"parameters": {
"post": [
{
"type": "uint64",
"name": "recordID",
"required": false,
"title": "Record ID"
},
{
"type": "uint64",
"name": "scriptID",
"required": true,
"title": "Script ID"
}
]
}
},
{
"name": "upload",
"path": "/attachment",
@@ -1502,10 +1480,38 @@
"type": "uint64",
"name": "scriptID",
"required": true,
"title": "automation ID"
"title": "Script ID"
}
]
}
},
{
"name": "runnable",
"method": "GET",
"title": "List of runnable (event=manual) scripts (executable on the backend or from user-agent/browser)",
"path": "/runnable",
"parameters": {
"get": [
{"name": "resource", "type": "string", "title": "Resource"},
{"name": "condition", "type": "string", "title": "Trigger condition"}
]
}
},
{
"name": "run",
"method": "POST",
"title": "Run a specific script or code at the backend. For testing and manual execution",
"path": "/run",
"parameters": {
"post": [
{"name": "scriptID", "type": "uint64", "title": "Script ID (scripts with manual triggers)"},
{"name": "source", "type": "string", "title": "Script's source code (overrides scriptID parameter)"},
{"name": "moduleID", "type": "uint64", "title": "Preload module and pass it to the automation script"},
{"name": "recordID", "type": "uint64", "title": "Preload record and pass it to the automation script"},
{"name": "module", "type": "interface{}", "title": "Module to pass to the automation script"},
{"name": "record", "type": "interface{}", "title": "Record to pass to the automation script"}
]
}
}
]
},
+61 -1
View File
@@ -215,11 +215,71 @@
{
"name": "scriptID",
"required": true,
"title": "automation ID",
"title": "Script ID",
"type": "uint64"
}
]
}
},
{
"Name": "runnable",
"Method": "GET",
"Title": "List of runnable (event=manual) scripts (executable on the backend or from user-agent/browser)",
"Path": "/runnable",
"Parameters": {
"get": [
{
"name": "resource",
"title": "Resource",
"type": "string"
},
{
"name": "condition",
"title": "Trigger condition",
"type": "string"
}
]
}
},
{
"Name": "run",
"Method": "POST",
"Title": "Run a specific script or code at the backend. For testing and manual execution",
"Path": "/run",
"Parameters": {
"post": [
{
"name": "scriptID",
"title": "Script ID (scripts with manual triggers)",
"type": "uint64"
},
{
"name": "source",
"title": "Script's source code (overrides scriptID parameter)",
"type": "string"
},
{
"name": "moduleID",
"title": "Preload module and pass it to the automation script",
"type": "uint64"
},
{
"name": "recordID",
"title": "Preload record and pass it to the automation script",
"type": "uint64"
},
{
"name": "module",
"title": "Module to pass to the automation script",
"type": "interface{}"
},
{
"name": "record",
"title": "Record to pass to the automation script",
"type": "interface{}"
}
]
}
}
]
}
-22
View File
@@ -199,28 +199,6 @@
]
}
},
{
"Name": "runScript",
"Method": "POST",
"Title": "Trigger a specific script on record",
"Path": "/run-script",
"Parameters": {
"post": [
{
"name": "recordID",
"required": false,
"title": "Record ID",
"type": "uint64"
},
{
"name": "scriptID",
"required": true,
"title": "Script ID",
"type": "uint64"
}
]
}
},
{
"Name": "upload",
"Method": "POST",