From 35be4eae6e808d34bbb73a0e2ae32d0c42fef1cf Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 21 Jan 2010 16:27:32 +0000 Subject: [PATCH] Allows to select ogroups git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15240 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../goto/events/class_EventTargetAddList.inc | 31 ++++++++++++++++--- .../goto/events/eventTargetSystems-filter.xml | 10 +++++- .../goto/events/eventTargetSystems-list.xml | 28 +++++++++++++++-- 3 files changed, 62 insertions(+), 7 deletions(-) diff --git a/gosa-plugins/goto/addons/goto/events/class_EventTargetAddList.inc b/gosa-plugins/goto/addons/goto/events/class_EventTargetAddList.inc index 01a1cabe0..06ab8c7ae 100644 --- a/gosa-plugins/goto/addons/goto/events/class_EventTargetAddList.inc +++ b/gosa-plugins/goto/addons/goto/events/class_EventTargetAddList.inc @@ -33,15 +33,16 @@ class EventTargetAddList extends management $this->storagePoints = array( get_ou("serverRDN"), get_ou("workstationRDN"), + get_ou("ogroupRDN"), get_ou('terminalRDN')); // Build filter - if (session::global_is_set(get_class($this)."_filter")){ - $filter= session::global_get(get_class($this)."_filter"); - } else { +# if (session::global_is_set(get_class($this)."_filter")){ + # $filter= session::global_get(get_class($this)."_filter"); + # } else { $filter = new filter(get_template_path("../../addons/goto/events/eventTargetSystems-filter.xml", TRUE)); $filter->setObjectStorage($this->storagePoints); - } + # } $this->setFilter($filter); // Build headpage @@ -66,14 +67,36 @@ class EventTargetAddList extends management function get_selected_targets() { + // Collect mac addresses $entries = $this->save(); $macs = array(); $ldap = $this->config->get_ldap_link(); $ldap->cd($this->config->current['BASE']); + $member_dns = array(); foreach($entries as $entry){ if(isset($entry['macAddress'][0])){ $macs[] = $entry['macAddress'][0]; } + if(in_array("gosaGroupOfNames", $entry['objectClass'])){ + $ldap->cat($entry['dn']); + if($ldap->count()){ + $attrs = $ldap->fetch(); + if(isset($attrs['member'])){ + for($i =0 ; $i< $attrs['member']['count']; $i++){ + $member_dns[] = $attrs['member'][$i]; + } + } + } + } + } + foreach($member_dns as $dn){ + $ldap->cat($dn, array('macAddress')); + if($ldap->count()){ + $attrs = $ldap->fetch(); + if(isset($attrs['macAddress'])){ + $macs[] = $attrs['macAddress'][0]; + } + } } return($macs); } diff --git a/gosa-plugins/goto/addons/goto/events/eventTargetSystems-filter.xml b/gosa-plugins/goto/addons/goto/events/eventTargetSystems-filter.xml index 7aa75de8d..9ccd976da 100644 --- a/gosa-plugins/goto/addons/goto/events/eventTargetSystems-filter.xml +++ b/gosa-plugins/goto/addons/goto/events/eventTargetSystems-filter.xml @@ -10,7 +10,7 @@ SystemByIp - (&(|$SERVER $WORKSTATION $TERMINAL ) $NAME) $IPSTART $IPSTOP $BYIP + (&(|$SERVER $WORKSTATION $TERMINAL $OGROUP) $NAME) $IPSTART $IPSTOP $BYIP dn objectClass cn @@ -75,6 +75,14 @@ + + checkbox + OGROUP + true + (objectClass=gosaGroupOfNames) + + + checkbox SERVER diff --git a/gosa-plugins/goto/addons/goto/events/eventTargetSystems-list.xml b/gosa-plugins/goto/addons/goto/events/eventTargetSystems-list.xml index b863f795e..4ef82076b 100644 --- a/gosa-plugins/goto/addons/goto/events/eventTargetSystems-list.xml +++ b/gosa-plugins/goto/addons/goto/events/eventTargetSystems-list.xml @@ -35,10 +35,18 @@ plugins/systems/images/select_terminal.png + + + gosaGroupOfNames + ogroups + ogroup + plugins/ogroups/images/ogroup.png + + - |20px;c|220px|| + |20px;c|220px|||| %{filter:objectType(dn,objectClass)} @@ -46,7 +54,7 @@ %{filter:departmentLink(row,dn,description)} - 1 + 3 @@ -69,6 +77,22 @@ true + + + ipHostNumber + string + %{ipHostNumber} + true + + + + + macAddress + string + %{macAddress} + true + +
-- 2.30.2