monitoring/API: Require a filter when scheduling host downtimes
refs #9606
This commit is contained in:
parent
04ae298c0c
commit
a0ff09da84
|
@ -19,11 +19,15 @@ class Monitoring_ActionsController extends Controller
|
||||||
*/
|
*/
|
||||||
public function scheduleHostDowntimeAction()
|
public function scheduleHostDowntimeAction()
|
||||||
{
|
{
|
||||||
// @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('host')->handleRequest()->fetchAll()
|
// @TODO(el): $this->backend->list('host')->handleRequest()->fetchAll()
|
||||||
$hostList = new HostList($this->backend);
|
$hostList = new HostList($this->backend);
|
||||||
$this->applyRestriction('monitoring/filter/objects', $hostList);
|
$this->applyRestriction('monitoring/filter/objects', $hostList);
|
||||||
$hostList->addFilter(Filter::fromQueryString((string) $this->params));
|
$hostList->addFilter($filter);
|
||||||
if (! $hostList->count()) {
|
if (! $hostList->count()) {
|
||||||
// @TODO(el): Use ApiResponse class for unified response handling.
|
// @TODO(el): Use ApiResponse class for unified response handling.
|
||||||
$this->getResponse()->sendJson(array(
|
$this->getResponse()->sendJson(array(
|
||||||
|
|
Loading…
Reference in New Issue