monitoring/security: Move applyRestriction() to the module's base controller

This commit is contained in:
Eric Lippmann 2015-01-27 14:22:37 +01:00
parent f37cd0cb95
commit 3cbafe16f6
2 changed files with 19 additions and 18 deletions

View File

@ -2,7 +2,6 @@
use Icinga\Module\Monitoring\Controller;
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\DeleteDowntimeCommandForm;
use Icinga\Web\Url;
@ -671,22 +670,6 @@ class Monitoring_ListController extends Controller
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()
{
$columns = preg_split(

View File

@ -4,9 +4,11 @@
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\Url;
use Icinga\File\Csv;
/**
* Base class for all monitoring action controller
@ -60,5 +62,21 @@ class Controller extends ModuleActionController
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;
}
}