monitoring/API: Require a filter when scheduling service downtimes

refs #9606
This commit is contained in:
Eric Lippmann 2015-08-25 09:23:36 +02:00
parent 146ea971c4
commit 04ae298c0c
1 changed files with 6 additions and 2 deletions

View File

@ -72,11 +72,15 @@ class Monitoring_ActionsController extends Controller
*/
public function scheduleServiceDowntimeAction()
{
// @TODO(el): Require a filter
$filter = Filter::fromQueryString((string) $this->params);
/** @var Filter $filter */
if ($filter->isEmpty()) {
$this->httpBadRequest('Filter must not be empty');
}
// @TODO(el): $this->backend->list('service')->handleRequest()->fetchAll()
$serviceList = new ServiceList($this->backend);
$this->applyRestriction('monitoring/filter/objects', $serviceList);
$serviceList->addFilter(Filter::fromQueryString((string) $this->params));
$serviceList->addFilter($filter);
if (! $serviceList->count()) {
// @TODO(el): Use ApiResponse class for unified response handling.
$this->getResponse()->sendJson(array(