Commit ee863f0b authored by Ad Schellevis's avatar Ad Schellevis

(proxy) require post action for service control

parent 3b62a276
......@@ -39,14 +39,18 @@ use \OPNsense\Proxy\Proxy;
class ServiceController extends ApiControllerBase
{
/**
* start proxy service
* start proxy service (in background)
* @return array
*/
public function startAction()
{
if ($this->request->isPost()) {
$backend = new Backend();
$response = $backend->configdRun("proxy start", true);
return array("response" => $response);
} else {
return array("response" => array());
}
}
/**
......@@ -55,9 +59,13 @@ class ServiceController extends ApiControllerBase
*/
public function stopAction()
{
if ($this->request->isPost()) {
$backend = new Backend();
$response = $backend->configdRun("proxy stop");
return array("response" => $response);
} else {
return array("response" => array());
}
}
/**
......@@ -66,9 +74,13 @@ class ServiceController extends ApiControllerBase
*/
public function restartAction()
{
if ($this->request->isPost()) {
$backend = new Backend();
$response = $backend->configdRun("proxy restart");
return array("response" => $response);
} else {
return array("response" => array());
}
}
/**
......@@ -105,6 +117,7 @@ class ServiceController extends ApiControllerBase
*/
public function reconfigureAction()
{
if ($this->request->isPost()) {
// close session for long running action
$this->sessionClose();
......@@ -131,5 +144,8 @@ class ServiceController extends ApiControllerBase
}
return array("status" => "ok");
} else {
return array("status" => "failed");
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment