From dae35b9106a7cc7cb8e68cb4a8a1a2c8e981b828 Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Fri, 5 Jun 2015 14:47:01 +0200 Subject: [PATCH] monitoring: Restrict host and service groups when viewing a host or service refs #9009 --- .../Monitoring/Object/MonitoredObject.php | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/modules/monitoring/library/Monitoring/Object/MonitoredObject.php b/modules/monitoring/library/Monitoring/Object/MonitoredObject.php index 4ff6ae6c9..a569341f6 100644 --- a/modules/monitoring/library/Monitoring/Object/MonitoredObject.php +++ b/modules/monitoring/library/Monitoring/Object/MonitoredObject.php @@ -308,12 +308,11 @@ abstract class MonitoredObject implements Filterable */ public function fetchHostgroups() { - $hostGroups = $this->backend->select()->from('hostgroup', array( - 'hostgroup_name', - 'hostgroup_alias' - )) - ->where('host_name', $this->host); - $this->hostgroups = $hostGroups->getQuery()->fetchPairs(); + $this->hostgroups = $this->backend->select() + ->from('hostgroup', array('hostgroup_name', 'hostgroup_alias')) + ->where('host_name', $this->host_name) + ->applyFilter($this->filter) + ->fetchPairs(); return $this; } @@ -407,13 +406,12 @@ abstract class MonitoredObject implements Filterable */ public function fetchServicegroups() { - $serviceGroups = $this->backend->select()->from('servicegroup', array( - 'servicegroup_name', - 'servicegroup_alias' - )) - ->where('service_host_name', $this->host_name) - ->where('service_description', $this->service_description); - $this->servicegroups = $serviceGroups->getQuery()->fetchPairs(); + $this->servicegroups = $this->backend->select() + ->from('servicegroup', array('servicegroup_name', 'servicegroup_alias')) + ->where('host_name', $this->host_name) + ->where('service_description', $this->service_description) + ->applyFilter($this->getFilter()) + ->fetchPairs(); return $this; }