monitoring: Restrict host and service groups when viewing a host or service

refs #9009
This commit is contained in:
Eric Lippmann 2015-06-05 14:47:01 +02:00
parent 5bc611f772
commit dae35b9106
1 changed files with 11 additions and 13 deletions

View File

@ -308,12 +308,11 @@ abstract class MonitoredObject implements Filterable
*/ */
public function fetchHostgroups() public function fetchHostgroups()
{ {
$hostGroups = $this->backend->select()->from('hostgroup', array( $this->hostgroups = $this->backend->select()
'hostgroup_name', ->from('hostgroup', array('hostgroup_name', 'hostgroup_alias'))
'hostgroup_alias' ->where('host_name', $this->host_name)
)) ->applyFilter($this->filter)
->where('host_name', $this->host); ->fetchPairs();
$this->hostgroups = $hostGroups->getQuery()->fetchPairs();
return $this; return $this;
} }
@ -407,13 +406,12 @@ abstract class MonitoredObject implements Filterable
*/ */
public function fetchServicegroups() public function fetchServicegroups()
{ {
$serviceGroups = $this->backend->select()->from('servicegroup', array( $this->servicegroups = $this->backend->select()
'servicegroup_name', ->from('servicegroup', array('servicegroup_name', 'servicegroup_alias'))
'servicegroup_alias' ->where('host_name', $this->host_name)
)) ->where('service_description', $this->service_description)
->where('service_host_name', $this->host_name) ->applyFilter($this->getFilter())
->where('service_description', $this->service_description); ->fetchPairs();
$this->servicegroups = $serviceGroups->getQuery()->fetchPairs();
return $this; return $this;
} }