From c089525bf73cff0ef2001476f0284887cbabd25a Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 13 Sep 2016 07:39:27 -0400 Subject: [PATCH] API CHANGE: 5 simple "actions" for sysadm/firewall Add five new "actions" for managing the firewall: "start" - turn on the firewall "stop" - turn off the firewall "restart" - reload the firewall (catches any settings changes - not generally needed) "enable" - automatically start the firewall on bootup "disable" - do not start the firewall on bootup They all use the same input/output syntax, just the "action" input field is different REST Request (example): ------------------------------- PUT /sysadm/firewall { "action" : "restart" } WebSocket Request: ------------------------------- { "id" : "fooid", "args" : { "action" : "restart" }, "namespace" : "sysadm", "name" : "firewall" } Response: ------------------------------- { "args": { "result": "success" }, "id": "fooid", "name": "response", "namespace": "sysadm" } --- src/server/WebBackend.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/server/WebBackend.cpp b/src/server/WebBackend.cpp index 1881217..f30949c 100644 --- a/src/server/WebBackend.cpp +++ b/src/server/WebBackend.cpp @@ -1170,6 +1170,26 @@ RestOutputStruct::ExitCode WebSocket::EvaluateSysadmFirewallRequest(const QJsonV FMGR.ClosePort(P); } + }else if(action=="start"){ + ok = true; + FMGR.Start(); + + }else if(action=="stop"){ + ok = true; + FMGR.Stop(); + + }else if(action=="restart"){ + ok = true; + FMGR.Restart(); + + }else if(action=="enable"){ + ok = true; + FMGR.Enable(); + + }else if(action=="disable"){ + ok = true; + FMGR.Disable(); + }