Importsources: remove dummy, allow import / export

This commit is contained in:
Thomas Gelf 2018-06-14 13:45:00 +02:00
parent 17321e4a5f
commit 5be3f092a9

View File

@ -30,10 +30,10 @@ class ImportsourcesController extends ActionController
if ($this->getRequest()->isApiRequest()) {
switch (strtolower($this->getRequest()->getMethod())) {
case 'get':
throw new \RuntimeException('sdaf');
$this->sendExport();
break;
case 'post':
$this->import($this->getRequest()->getRawBody());
$this->acceptImport($this->getRequest()->getRawBody());
break;
// TODO: put / replace all?
default:
@ -53,6 +53,15 @@ class ImportsourcesController extends ActionController
(new ImportsourceTable($this->db()))->renderTo($this);
}
/**
* @param $raw
* @throws \Icinga\Exception\ConfigurationError
*/
protected function acceptImport(& $raw)
{
(new ImportExport($this->db()))->unserializeImportSources(json_decode($raw));
}
/**
* @throws \Icinga\Exception\ConfigurationError
*/