Merge branch 'bugfix/format-lacks-restriction-9965'

fixes #9965
This commit is contained in:
Eric Lippmann 2015-08-25 09:19:00 +02:00
commit 6ab61ba8e0

View File

@ -24,24 +24,6 @@ class Monitoring_ListController extends Controller
$this->createTabs(); $this->createTabs();
} }
/**
* @deprecated DO NOT USE. THIS IS A HACK. This is removed once we fix the eventhistory action w/ filters.
*/
protected function applyFilter($query)
{
$params = clone $this->params;
$params->shift('format');
$params->shift('limit');
$params->shift('page');
$params->shift('view');
if ($sort = $params->shift('sort')) {
$query->order($sort, $params->shift('dir'));
}
$query->applyFilter(Filter::fromQuerystring((string) $params));
$this->handleFormatRequest($query);
return $query;
}
/** /**
* Overwrite the backend to use (used for testing) * Overwrite the backend to use (used for testing)
* *
@ -91,8 +73,8 @@ class Monitoring_ListController extends Controller
'host_current_check_attempt', 'host_current_check_attempt',
'host_max_check_attempts' 'host_max_check_attempts'
), $this->addColumns())); ), $this->addColumns()));
$this->filterQuery($query);
$this->applyRestriction('monitoring/filter/objects', $query); $this->applyRestriction('monitoring/filter/objects', $query);
$this->filterQuery($query);
$this->view->hosts = $query; $this->view->hosts = $query;
$stats = $this->backend->select()->from('hoststatussummary', array( $stats = $this->backend->select()->from('hoststatussummary', array(
'hosts_total', 'hosts_total',
@ -177,8 +159,8 @@ class Monitoring_ListController extends Controller
'max_check_attempts' => 'service_max_check_attempts' 'max_check_attempts' => 'service_max_check_attempts'
), $this->addColumns()); ), $this->addColumns());
$query = $this->backend->select()->from('servicestatus', $columns); $query = $this->backend->select()->from('servicestatus', $columns);
$this->filterQuery($query);
$this->applyRestriction('monitoring/filter/objects', $query); $this->applyRestriction('monitoring/filter/objects', $query);
$this->filterQuery($query);
$this->view->services = $query; $this->view->services = $query;
$this->setupLimitControl(); $this->setupLimitControl();
@ -242,9 +224,8 @@ class Monitoring_ListController extends Controller
'host_display_name', 'host_display_name',
'service_display_name' 'service_display_name'
)); ));
$this->filterQuery($query);
$this->applyRestriction('monitoring/filter/objects', $query); $this->applyRestriction('monitoring/filter/objects', $query);
$this->filterQuery($query);
$this->view->downtimes = $query; $this->view->downtimes = $query;
@ -291,8 +272,8 @@ class Monitoring_ListController extends Controller
'host_display_name', 'host_display_name',
'service_display_name' 'service_display_name'
)); ));
$this->filterQuery($query);
$this->applyRestriction('monitoring/filter/objects', $query); $this->applyRestriction('monitoring/filter/objects', $query);
$this->filterQuery($query);
$this->view->notifications = $query; $this->view->notifications = $query;
$this->setupLimitControl(); $this->setupLimitControl();
@ -314,8 +295,8 @@ class Monitoring_ListController extends Controller
'contact_notify_service_timeperiod', 'contact_notify_service_timeperiod',
'contact_notify_host_timeperiod' 'contact_notify_host_timeperiod'
)); ));
$this->filterQuery($query);
$this->applyRestriction('monitoring/filter/objects', $query); $this->applyRestriction('monitoring/filter/objects', $query);
$this->filterQuery($query);
$this->view->contacts = $query; $this->view->contacts = $query;
$this->setupLimitControl(); $this->setupLimitControl();
@ -386,8 +367,8 @@ class Monitoring_ListController extends Controller
'contact_email', 'contact_email',
'contact_pager' 'contact_pager'
)); ));
$this->filterQuery($query);
$this->applyRestriction('monitoring/filter/objects', $query); $this->applyRestriction('monitoring/filter/objects', $query);
$this->filterQuery($query);
$this->setupSortControl(array( $this->setupSortControl(array(
'contactgroup_name' => $this->translate('Contactgroup Name'), 'contactgroup_name' => $this->translate('Contactgroup Name'),
@ -430,10 +411,8 @@ class Monitoring_ListController extends Controller
'host_display_name', 'host_display_name',
'service_display_name' 'service_display_name'
)); ));
$this->filterQuery($query);
$this->applyRestriction('monitoring/filter/objects', $query); $this->applyRestriction('monitoring/filter/objects', $query);
$this->filterQuery($query);
$this->view->comments = $query; $this->view->comments = $query;
$this->setupLimitControl(); $this->setupLimitControl();
@ -485,10 +464,8 @@ class Monitoring_ListController extends Controller
'services_warning_last_state_change_unhandled' => 'services_warning_unhandled_last_state_change', 'services_warning_last_state_change_unhandled' => 'services_warning_unhandled_last_state_change',
'services_warning_unhandled' 'services_warning_unhandled'
)); ));
$this->filterQuery($query);
$this->applyRestriction('monitoring/filter/objects', $query); $this->applyRestriction('monitoring/filter/objects', $query);
$this->filterQuery($query);
$this->view->servicegroups = $query; $this->view->servicegroups = $query;
$this->setupLimitControl(); $this->setupLimitControl();
@ -531,10 +508,8 @@ class Monitoring_ListController extends Controller
'services_warning_handled', 'services_warning_handled',
'services_warning_unhandled' 'services_warning_unhandled'
)); ));
$this->filterQuery($query);
$this->applyRestriction('monitoring/filter/objects', $query); $this->applyRestriction('monitoring/filter/objects', $query);
$this->filterQuery($query);
$this->view->hostgroups = $query; $this->view->hostgroups = $query;
$this->setupLimitControl(); $this->setupLimitControl();
@ -589,8 +564,8 @@ class Monitoring_ListController extends Controller
'service_output', 'service_output',
'service_handled' 'service_handled'
)); ));
$this->filterQuery($query);
$this->applyRestriction('monitoring/filter/objects', $query); $this->applyRestriction('monitoring/filter/objects', $query);
$this->filterQuery($query);
$this->setupSortControl(array( $this->setupSortControl(array(
'host_name' => $this->translate('Hostname'), 'host_name' => $this->translate('Hostname'),
'service_description' => $this->translate('Service description') 'service_description' => $this->translate('Service description')