Update runTest API in all endpoint plugins. Add action=test in edit_notification_recipient.lua

This commit is contained in:
Alfredo Cardigliano 2020-07-28 15:52:41 +02:00
parent 8cd379bfb9
commit e344508df1
8 changed files with 145 additions and 99 deletions

View file

@ -15,23 +15,25 @@ local action = _POST["action"]
sendHTTPContentTypeHeader('application/json')
if not haveAdminPrivileges() then
return
return
end
local response = {}
local recipient_name = _POST["recipient_name"]
if (action == "add") then
local endpoint_conf_name = _POST["endpoint_conf_name"]
response.result = notification_recipients.add_recipient(endpoint_conf_name, recipient_name, _POST)
local endpoint_conf_name = _POST["endpoint_conf_name"]
response.result = notification_recipients.add_recipient(endpoint_conf_name, recipient_name, _POST)
elseif (action == "edit") then
response.result = notification_recipients.edit_recipient(recipient_name, _POST)
response.result = notification_recipients.edit_recipient(recipient_name, _POST)
elseif (action == "remove") then
response.result = notification_recipients.delete_recipient(recipient_name)
response.result = notification_recipients.delete_recipient(recipient_name)
elseif (action == "test") then
response.result = notification_recipients.test_recipient(recipient_name)
else
traceError(TRACE_ERROR, TRACE_CONSOLE, "Invalid 'action' parameter.")
response.success = false
response.message = "Invalid 'action' parameter."
traceError(TRACE_ERROR, TRACE_CONSOLE, "Invalid 'action' parameter.")
response.success = false
response.message = "Invalid 'action' parameter."
end
print(json.encode(response))