monitoring: Return an empty filter in Controller::getRestriction() if the authenticated user is not restricted

This is because applyFilter requires a filter object.
This commit is contained in:
Eric Lippmann 2015-08-20 14:24:06 +02:00
parent 432abb1d33
commit 2229665ec6
1 changed files with 2 additions and 4 deletions

View File

@ -60,9 +60,7 @@ class Controller extends IcingaWebController
*/ */
protected function applyRestriction($name, Filterable $filterable) protected function applyRestriction($name, Filterable $filterable)
{ {
if (null !== $restriction = $restriction = $this->getRestriction($name)) { $filterable->applyFilter($this->getRestriction($name));
$filterable->applyFilter($restriction);
}
return $filterable; return $filterable;
} }
@ -88,7 +86,7 @@ class Controller extends IcingaWebController
)); ));
foreach ($this->getRestrictions($name) as $filter) { foreach ($this->getRestrictions($name) as $filter) {
if ($filter === '*') { if ($filter === '*') {
return null; return Filter::matchAny();
} }
try { try {
$restriction->addFilter(Filter::fromQueryString($filter)); $restriction->addFilter(Filter::fromQueryString($filter));