mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-29 08:44:11 +02:00
ActionController: provide response-helper for all
...controllers
This commit is contained in:
parent
db8a14e854
commit
24a5411a93
@ -11,20 +11,6 @@ class ImportsourcesController extends ActionController
|
|||||||
{
|
{
|
||||||
protected $isApified = true;
|
protected $isApified = true;
|
||||||
|
|
||||||
protected function sendUnsupportedMethod()
|
|
||||||
{
|
|
||||||
$method = strtoupper($this->getRequest()->getMethod()) ;
|
|
||||||
$response = $this->getResponse();
|
|
||||||
$this->sendJsonError($response, sprintf(
|
|
||||||
'Method %s is not supported',
|
|
||||||
$method
|
|
||||||
), 422); // TODO: check response code
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @throws \Icinga\Exception\ConfigurationError
|
|
||||||
* @throws \Icinga\Exception\Http\HttpNotFoundException
|
|
||||||
*/
|
|
||||||
public function indexAction()
|
public function indexAction()
|
||||||
{
|
{
|
||||||
if ($this->getRequest()->isApiRequest()) {
|
if ($this->getRequest()->isApiRequest()) {
|
||||||
@ -55,16 +41,12 @@ class ImportsourcesController extends ActionController
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $raw
|
* @param $raw
|
||||||
* @throws \Icinga\Exception\ConfigurationError
|
|
||||||
*/
|
*/
|
||||||
protected function acceptImport(&$raw)
|
protected function acceptImport($raw)
|
||||||
{
|
{
|
||||||
(new ImportExport($this->db()))->unserializeImportSources(json_decode($raw));
|
(new ImportExport($this->db()))->unserializeImportSources(json_decode($raw));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @throws \Icinga\Exception\ConfigurationError
|
|
||||||
*/
|
|
||||||
protected function sendExport()
|
protected function sendExport()
|
||||||
{
|
{
|
||||||
$this->sendJson(
|
$this->sendJson(
|
||||||
|
@ -188,6 +188,16 @@ abstract class ActionController extends Controller implements ControlsAndContent
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function sendUnsupportedMethod()
|
||||||
|
{
|
||||||
|
$method = strtoupper($this->getRequest()->getMethod()) ;
|
||||||
|
$response = $this->getResponse();
|
||||||
|
$this->sendJsonError($response, sprintf(
|
||||||
|
'Method %s is not supported',
|
||||||
|
$method
|
||||||
|
), 422); // TODO: check response code
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $permission
|
* @param string $permission
|
||||||
* @return $this
|
* @return $this
|
||||||
|
Loading…
x
Reference in New Issue
Block a user