mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-29 00:34:03 +02:00
monitoring/security: Move applyRestriction() to the module's base controller
This commit is contained in:
parent
f37cd0cb95
commit
3cbafe16f6
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
use Icinga\Module\Monitoring\Controller;
|
use Icinga\Module\Monitoring\Controller;
|
||||||
use Icinga\Module\Monitoring\Backend;
|
use Icinga\Module\Monitoring\Backend;
|
||||||
use Icinga\Module\Monitoring\DataView\DataView;
|
|
||||||
use Icinga\Module\Monitoring\Forms\Command\Object\DeleteCommentCommandForm;
|
use Icinga\Module\Monitoring\Forms\Command\Object\DeleteCommentCommandForm;
|
||||||
use Icinga\Module\Monitoring\Forms\Command\Object\DeleteDowntimeCommandForm;
|
use Icinga\Module\Monitoring\Forms\Command\Object\DeleteDowntimeCommandForm;
|
||||||
use Icinga\Web\Url;
|
use Icinga\Web\Url;
|
||||||
@ -671,22 +670,6 @@ class Monitoring_ListController extends Controller
|
|||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Apply a restriction on the given data view
|
|
||||||
*
|
|
||||||
* @param string $restriction The name of restriction
|
|
||||||
* @param DataView $view The view to restrict
|
|
||||||
*
|
|
||||||
* @return DataView $view
|
|
||||||
*/
|
|
||||||
protected function applyRestriction($restriction, DataView $view)
|
|
||||||
{
|
|
||||||
foreach ($this->getRestrictions($restriction) as $filter) {
|
|
||||||
$view->applyFilter(Filter::fromQueryString($filter));
|
|
||||||
}
|
|
||||||
return $view;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function extraColumns()
|
protected function extraColumns()
|
||||||
{
|
{
|
||||||
$columns = preg_split(
|
$columns = preg_split(
|
||||||
|
@ -4,9 +4,11 @@
|
|||||||
|
|
||||||
namespace Icinga\Module\Monitoring;
|
namespace Icinga\Module\Monitoring;
|
||||||
|
|
||||||
|
use Icinga\Data\Filter\Filter;
|
||||||
|
use Icinga\File\Csv;
|
||||||
|
use Icinga\Module\Monitoring\DataView\DataView;
|
||||||
use Icinga\Web\Controller\ModuleActionController;
|
use Icinga\Web\Controller\ModuleActionController;
|
||||||
use Icinga\Web\Url;
|
use Icinga\Web\Url;
|
||||||
use Icinga\File\Csv;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for all monitoring action controller
|
* Base class for all monitoring action controller
|
||||||
@ -60,5 +62,21 @@ class Controller extends ModuleActionController
|
|||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply a restriction on the given data view
|
||||||
|
*
|
||||||
|
* @param string $restriction The name of restriction
|
||||||
|
* @param DataView $view The view to restrict
|
||||||
|
*
|
||||||
|
* @return DataView $view
|
||||||
|
*/
|
||||||
|
protected function applyRestriction($restriction, DataView $view)
|
||||||
|
{
|
||||||
|
foreach ($this->getRestrictions($restriction) as $filter) {
|
||||||
|
$view->applyFilter(Filter::fromQueryString($filter));
|
||||||
|
}
|
||||||
|
return $view;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user