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()) { if ($this->getRequest()->isApiRequest()) {
switch (strtolower($this->getRequest()->getMethod())) { switch (strtolower($this->getRequest()->getMethod())) {
case 'get': case 'get':
throw new \RuntimeException('sdaf'); $this->sendExport();
break; break;
case 'post': case 'post':
$this->import($this->getRequest()->getRawBody()); $this->acceptImport($this->getRequest()->getRawBody());
break; break;
// TODO: put / replace all? // TODO: put / replace all?
default: default:
@ -53,6 +53,15 @@ class ImportsourcesController extends ActionController
(new ImportsourceTable($this->db()))->renderTo($this); (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 * @throws \Icinga\Exception\ConfigurationError
*/ */