From e0e71a2cf970e114d3bae542d52f0d652dae422d Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 8 Feb 2008 12:41:44 +0000 Subject: [PATCH] Some fixed for app groups git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8780 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../groups/apps/class_groupApplication2.inc | 45 ++++++++++++------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/gosa-plugins/goto/admin/groups/apps/class_groupApplication2.inc b/gosa-plugins/goto/admin/groups/apps/class_groupApplication2.inc index f3476f02b..d1822939b 100644 --- a/gosa-plugins/goto/admin/groups/apps/class_groupApplication2.inc +++ b/gosa-plugins/goto/admin/groups/apps/class_groupApplication2.inc @@ -50,7 +50,7 @@ class appgroup2 extends plugin if(1 | !isset($this->_cache['ReleaseApps'][$release_info['suffix']])){ $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->curbase); + $ldap->cd($this->config->current['BASE']); $ldap->search("ou=apps",array("dn")); $app_deps = array(); while($attrs = $ldap->fetch()){ @@ -304,6 +304,7 @@ class appgroup2 extends plugin $ldap = $this->config->get_ldap_link(); $all = $this->_get_all_entries(); $prio = 0; + $Actions = array("Remove" => array(),"Edit" => array() , "Add" => array()); foreach($all as $entry){ $prio ++; $cur = $entry; @@ -352,33 +353,43 @@ class appgroup2 extends plugin break; } - echo $entry['STATUS']." ---> ".$cur_dn."
"; if($entry['STATUS'] == "LOADED"){ continue; } if($entry['STATUS'] == "REMOVED"){ - echo "REMOVE
"; - $ldap->rmdir_recursive($cur_dn); - echo $ldap->get_error(); + $Actions['Remove'][$cur_dn] = $cur_dn; } if($entry['STATUS'] == "EDITED"){ - echo "EDITED
"; - $ldap->cd($cur_dn); - $ldap->modify($attrs); - echo $ldap->get_error(); - print_a($attrs); + $Actions['Edit'][$cur_dn] = $attrs; } if($entry['STATUS'] == "ADDED"){ - echo "ADDED
"; - $ldap->cd($cur_dn); - $ldap->add($attrs); - echo $ldap->get_error(); - print_a($attrs); + $Actions['Add'][$cur_dn] = $attrs; } } - print_a($this->a_Structure); - exit(); + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + foreach($Actions['Remove'] as $dn){ + $ldap->cd($dn); + $ldap->cat($dn); + if($ldap->count()){ + $ldap->rmdir_recursive($dn); + } + } + foreach($Actions['Add'] as $dn => $data){ + $ldap->cd($dn); + $ldap->cat($dn); + if(!$ldap->count()){ + $ldap->add($data); + } + } + foreach($Actions['Edit'] as $dn => $data){ + $ldap->cd($dn); + $ldap->cat($dn); + if($ldap->count()){ + $ldap->modify($data); + } + } } -- 2.30.2