mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-06-10 09:10:05 -04:00
Controller: Add method applyMonitoringRestriction
This commit is contained in:
parent
7ed4839848
commit
ccd0709fba
1 changed files with 17 additions and 0 deletions
|
|
@ -6,6 +6,8 @@ use Generator;
|
|||
use Icinga\Application\Icinga;
|
||||
use Icinga\Data\Filter\Filter;
|
||||
use Icinga\Data\ResourceFactory;
|
||||
use Icinga\Module\Icingadb\Compat\MonitoringRestrictions;
|
||||
use Icinga\Module\Icingadb\Compat\UrlMigrator;
|
||||
use Icinga\Module\Icingadb\Widget\FilterControl;
|
||||
use Icinga\Module\Icingadb\Widget\ViewModeSwitcher;
|
||||
use ipl\Html\Html;
|
||||
|
|
@ -208,6 +210,21 @@ class Controller extends CompatController
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function applyMonitoringRestriction(Query $query, $queryTransformer = null)
|
||||
{
|
||||
if ($queryTransformer === null || UrlMigrator::hasQueryTransformer($queryTransformer)) {
|
||||
$restriction = UrlMigrator::transformFilter(
|
||||
MonitoringRestrictions::getRestriction('monitoring/filter/objects'),
|
||||
$queryTransformer
|
||||
);
|
||||
if ($restriction) {
|
||||
FilterProcessor::apply($restriction, $query);
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function preDispatch()
|
||||
{
|
||||
$this->format = $this->params->shift('format');
|
||||
|
|
|
|||
Loading…
Reference in a new issue