From d40e85b8a3c458a1fb0a3da2d63846f8f70cdce6 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Mon, 15 Apr 2019 16:03:43 +0200 Subject: [PATCH] Monitoring\Controller#getRestriction(): return filters matching all, not none Filter::matchAny() without any subfilters matches none, Filter::matchAll() without any subfilters matches all. --- modules/monitoring/library/Monitoring/Controller.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Controller.php b/modules/monitoring/library/Monitoring/Controller.php index faeddc80d..1fb81b4de 100644 --- a/modules/monitoring/library/Monitoring/Controller.php +++ b/modules/monitoring/library/Monitoring/Controller.php @@ -97,7 +97,7 @@ class Controller extends IcingaWebController * * @param string $name Name of the restriction * - * @return Filter|null Filter object or null if the authenticated user is not restricted + * @return Filter Filter object * @throws ConfigurationError If the restriction contains invalid filter columns */ protected function getRestriction($name) @@ -115,7 +115,7 @@ class Controller extends IcingaWebController )); foreach ($this->getRestrictions($name) as $filter) { if ($filter === '*') { - return Filter::matchAny(); + return Filter::matchAll(); } try { $restriction->addFilter(Filter::fromQueryString($filter)); @@ -138,6 +138,11 @@ class Controller extends IcingaWebController ); } } + + if ($restriction->isEmpty()) { + return Filter::matchAll(); + } + return $restriction; } }