monitoring/list/*: Don't apply restrictions in case of ?format=sql

This commit is contained in:
Johannes Meyer 2021-02-16 16:55:56 +01:00
parent 5fae8fc2b2
commit 76dafc8c1e

View File

@ -82,7 +82,6 @@ class ListController extends Controller
'host_check_command', 'host_check_command',
'host_next_update' 'host_next_update'
), $this->addColumns())); ), $this->addColumns()));
$this->applyRestriction('monitoring/filter/objects', $hosts);
$this->setupPaginationControl($hosts); $this->setupPaginationControl($hosts);
$this->setupSortControl(array( $this->setupSortControl(array(
@ -164,7 +163,6 @@ class ListController extends Controller
'service_check_command', 'service_check_command',
'service_next_update' 'service_next_update'
), $this->addColumns())); ), $this->addColumns()));
$this->applyRestriction('monitoring/filter/objects', $services);
$this->setupPaginationControl($services); $this->setupPaginationControl($services);
$this->setupSortControl(array( $this->setupSortControl(array(
@ -242,7 +240,6 @@ class ListController extends Controller
'host_display_name', 'host_display_name',
'service_display_name' 'service_display_name'
)); ));
$this->applyRestriction('monitoring/filter/objects', $downtimes);
$this->setupPaginationControl($downtimes); $this->setupPaginationControl($downtimes);
$this->setupSortControl(array( $this->setupSortControl(array(
@ -292,7 +289,6 @@ class ListController extends Controller
'service_description', 'service_description',
'service_display_name' 'service_display_name'
)); ));
$this->applyRestriction('monitoring/filter/objects', $notifications);
$this->setupPaginationControl($notifications); $this->setupPaginationControl($notifications);
$this->setupSortControl(array( $this->setupSortControl(array(
@ -327,7 +323,6 @@ class ListController extends Controller
'contact_notify_service_timeperiod', 'contact_notify_service_timeperiod',
'contact_notify_host_timeperiod' 'contact_notify_host_timeperiod'
)); ));
$this->applyRestriction('monitoring/filter/objects', $contacts);
$this->setupPaginationControl($contacts); $this->setupPaginationControl($contacts);
$this->setupSortControl(array( $this->setupSortControl(array(
@ -407,7 +402,6 @@ class ListController extends Controller
'contactgroup_alias', 'contactgroup_alias',
'contact_count' 'contact_count'
)); ));
$this->applyRestriction('monitoring/filter/objects', $contactGroups);
$this->setupPaginationControl($contactGroups); $this->setupPaginationControl($contactGroups);
$this->setupSortControl(array( $this->setupSortControl(array(
@ -448,7 +442,6 @@ class ListController extends Controller
'host_display_name', 'host_display_name',
'service_display_name' 'service_display_name'
)); ));
$this->applyRestriction('monitoring/filter/objects', $comments);
$this->setupPaginationControl($comments); $this->setupPaginationControl($comments);
$this->setupSortControl( $this->setupSortControl(
@ -498,7 +491,6 @@ class ListController extends Controller
'services_warning_handled', 'services_warning_handled',
'services_warning_unhandled' 'services_warning_unhandled'
)); ));
$this->applyRestriction('monitoring/filter/objects', $serviceGroups);
$this->setupPaginationControl($serviceGroups); $this->setupPaginationControl($serviceGroups);
$this->setupSortControl(array( $this->setupSortControl(array(
@ -538,7 +530,6 @@ class ListController extends Controller
'services_warning_handled', 'services_warning_handled',
'services_warning_unhandled' 'services_warning_unhandled'
)); ));
$this->applyRestriction('monitoring/filter/objects', $serviceGroups);
$this->filterQuery($serviceGroups); $this->filterQuery($serviceGroups);
$this->setupSortControl(array( $this->setupSortControl(array(
@ -583,7 +574,6 @@ class ListController extends Controller
'services_warning_handled', 'services_warning_handled',
'services_warning_unhandled' 'services_warning_unhandled'
)); ));
$this->applyRestriction('monitoring/filter/objects', $hostGroups);
$this->setupPaginationControl($hostGroups); $this->setupPaginationControl($hostGroups);
$this->setupSortControl(array( $this->setupSortControl(array(
@ -622,7 +612,6 @@ class ListController extends Controller
'hosts_unreachable_unhandled', 'hosts_unreachable_unhandled',
'hosts_up' 'hosts_up'
]); ]);
$this->applyRestriction('monitoring/filter/objects', $hostGroups);
$this->filterQuery($hostGroups); $this->filterQuery($hostGroups);
$this->setupSortControl([ $this->setupSortControl([
@ -656,7 +645,6 @@ class ListController extends Controller
'type' 'type'
)); ));
$this->applyRestriction('monitoring/filter/objects', $query);
$this->view->history = $query; $this->view->history = $query;
$this->setupSortControl(array( $this->setupSortControl(array(
@ -683,7 +671,6 @@ class ListController extends Controller
'service_output', 'service_output',
'service_state' 'service_state'
)); ));
$this->applyRestriction('monitoring/filter/objects', $query);
$this->filterQuery($query); $this->filterQuery($query);
$filter = (bool) $this->params->shift('problems', false) ? Filter::where('service_problem', 1) : null; $filter = (bool) $this->params->shift('problems', false) ? Filter::where('service_problem', 1) : null;
@ -750,7 +737,13 @@ class ListController extends Controller
'problems', // servicegridAction() 'problems', // servicegridAction()
'flipped' // servicegridAction() 'flipped' // servicegridAction()
)); ));
if ($this->params->get('format') !== 'sql' || $this->hasPermission('config/authentication/roles/show')) {
$this->applyRestriction('monitoring/filter/objects', $dataView);
}
$this->handleFormatRequest($dataView); $this->handleFormatRequest($dataView);
return $dataView; return $dataView;
} }