From 43a9f51a389498ac27e3c87e6aa286f5e9628d76 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 20 Feb 2008 10:23:31 +0000 Subject: [PATCH] Updated gotmossesn -Only display entries with macAddress -Resolv ogroups, just add entry dns, not cns. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8982 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../gotomasses/events/class_DaemonEvent.inc | 49 ++++++++++++++++--- 1 file changed, 42 insertions(+), 7 deletions(-) diff --git a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc index 940077145..d321a3f20 100644 --- a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc +++ b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc @@ -43,6 +43,9 @@ class DaemonEvent protected $is_new = TRUE; // Is TRUE if this is a new event protected $_target_list = array(); // Object Cache of those objects displayed in the target add dialog + protected $workstation_list = array(); + protected $server_list = array(); + public function __construct($config,$data = array()) { $this->data = $data; @@ -54,6 +57,24 @@ class DaemonEvent if(count($data)){ $this->is_new = FALSE; } + + /* Create a list of servers + */ + $tmp = get_sub_list("(&(macAddress=*)(objectClass=goServer))", + "server",get_ou("serverou"),$config->current['BASE'], + array("cn","objectClass","description","ipHostNumber","macAddress"),GL_SUBSEARCH); + foreach($tmp as $server){ + $this->server_list[$server['dn']] = $server; + } + + /* Create a list of workstations + */ + $tmp = get_sub_list("(&(macAddress=*)(objectClass=gotoWorkstation))", + "server",get_ou("workstationou"),$config->current['BASE'], + array("cn","objectClass","description","ipHostNumber","macAddress"),GL_SUBSEARCH); + foreach($tmp as $server){ + $this->workstation_list[$server['dn']] = $server; + } } public function execute() @@ -275,9 +296,9 @@ class DaemonEvent array("cn","objectClass","description","ipHostNumber","macAddress"),GL_NONE)); } if($this->target_divlist->display_ogroup){ - $_target_list = array_merge($_target_list,get_list("(&(cn=".$this->target_divlist->regex.")(objectClass=gosaGroupOfNames))", + $_target_list = array_merge($_target_list,get_list("(&(cn=".$this->target_divlist->regex.")(member=*)(objectClass=gosaGroupOfNames))", "ogroups",get_ou("ogroupou").$this->target_divlist->selectedBase, - array("cn","objectClass","description"),GL_NONE)); + array("cn","objectClass","description","member"),GL_NONE)); } $this->_target_list = $_target_list; @@ -290,6 +311,7 @@ class DaemonEvent foreach($tmp as $key => $dummy){ $obj = $this->_target_list[$key]; + $name = $obj['cn'][0]; if(isset($obj['description'])){ $name .= " [".$obj['description'][0]."]"; @@ -310,7 +332,9 @@ class DaemonEvent continue; } } - + if(!isset($this->server_list[$obj['dn']])){ + continue; + } }elseif(in_array("gotoWorkstation",$obj['objectClass'])){ $img = 'W'; if($this->target_divlist->filter_iprange){ @@ -318,7 +342,9 @@ class DaemonEvent continue; } } - + if(!isset($this->workstation_list[$obj['dn']])){ + continue; + } }elseif(in_array("gosaGroupOfNames",$obj['objectClass'])){ $img = 'O'; } @@ -350,10 +376,19 @@ class DaemonEvent if(isset($_POST['save_target_dialog'])){ $this->target_add_list_used =FALSE; foreach($this->list_get_selected_items() as $id){ - if(isset($this->_target_list[$id]['macAddress'][0])){ - $this->a_targets[] = $this->_target_list[$id]['macAddress'][0]; + if(in_array("gosaGroupOfNames",$this->_target_list[$id]['objectClass'])){ + foreach($this->_target_list[$id]['member'] as $mem_dn){ + if(isset($this->workstation_list[$mem_dn])){ + $this->a_targets[] = $this->workstation_list[$mem_dn]['macAddress'][0]; + } + if(isset($this->server_list[$mem_dn])){ + $this->a_targets[] = $this->server_list[$mem_dn]['macAddress'][0]; + } + } }else{ - $this->a_targets[] = $this->_target_list[$id]['cn'][0]; + if(isset($this->_target_list[$id]['macAddress'][0])){ + $this->a_targets[] = $this->_target_list[$id]['macAddress'][0]; + } } } $this->target_divlist = NULL; -- 2.30.2