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-23 13:49:36 +02:00
parent 6463df9af1
commit ffdeef1da2
22 changed files with 895 additions and 298 deletions
+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",