From d575e7e6f539e5df31b48d5845964e24f28dc71a Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 22 Mar 2006 08:32:35 +0000 Subject: [PATCH] Application branch problems git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2885 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_ldap.inc | 40 +++++++++++++++-------- plugins/admin/fai/class_faiManagement.inc | 6 ++++ 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/include/class_ldap.inc b/include/class_ldap.inc index 5bc19ed63..70b1a09f5 100644 --- a/include/class_ldap.inc +++ b/include/class_ldap.inc @@ -400,8 +400,7 @@ class LDAP{ function copy_FAI_resource_recursive($sourcedn,$destinationdn,$type="branch",$is_first = true,$depth=0) { error_reporting(E_ALL); - - + if($is_first){ echo "

". sprintf(_("Creating duplicate of %s in %s"),"
".$sourcedn."
","
".$destinationdn."
")."

"; @@ -434,14 +433,25 @@ class LDAP{ $delarray= array(); /* Check if destination entry already exists */ - if($this->count($this->fetch($this->cat($destinationdn)))){ + $this->cat($destinationdn); + + if($this->count()){ return; }else{ + + $this->clearResult(); - /* Get source entrie */ + /* Get source entry */ $this->cd($basedn); - $attr = $this->fetch($this->cat($sourcedn)); + $this->cat($sourcedn); + $attr = $this->fetch(); + /* Error while fetching object / attribute abort*/ + if((!$attr) || (count($attr)) ==0) { + echo "error while fetching source dn .."; + return; + } + /* check if this is a department */ if(in_array("organizationalUnit",$attr['objectClass'])){ $attr['dn'] = $this->convert($destinationdn); @@ -472,8 +482,9 @@ class LDAP{ /* Add this entry */ $this->modify($attr); } - + echo "Department"; }else{ + echo "Object"; /* If this is no department */ foreach($attr as $key => $value){ @@ -496,15 +507,16 @@ class LDAP{ unset($attr['count']); unset($attr['dn']); - - if($type=="branch"){ - $attr['FAIstate'] ="branch"; - }elseif($type=="freeze"){ - $attr['FAIstate'] ="freeze"; - }else{ - print_red(_("Unknown FAIstate %s"),$type); + if(!in_array("gosaApplication" , $attr['objectClass'])){ + if($type=="branch"){ + $attr['FAIstate'] ="branch"; + }elseif($type=="freeze"){ + $attr['FAIstate'] ="freeze"; + }else{ + print_red(_("Unknown FAIstate %s"),$type); + } } - + /* Add entry */ $this->cd($destinationdn); $a = $this->fetch($this->cat($destinationdn)); diff --git a/plugins/admin/fai/class_faiManagement.inc b/plugins/admin/fai/class_faiManagement.inc index 64f68a7e0..51bfdb119 100644 --- a/plugins/admin/fai/class_faiManagement.inc +++ b/plugins/admin/fai/class_faiManagement.inc @@ -419,9 +419,15 @@ class faiManagement extends plugin $baseToUse = $_SESSION['faifilter']['branch']; } + + $appsrc = preg_replace("/ou=fai,ou=configs,ou=systems,/","ou=apps,",$baseToUse)."
" ; + $appdst = preg_replace("/ou=fai,ou=configs,ou=systems,/","ou=apps,","ou=".$name.",".$baseToUse)."
" ; + $ldap->cd ("ou=".$name.",".$baseToUse); $ldap->recursive_remove(); + $ldap->cd ($this->config->current['BASE']); + $ldap->copy_FAI_resource_recursive($appsrc,$appdst,$type,true); $ldap->cd ($this->config->current['BASE']); $ldap->copy_FAI_resource_recursive($baseToUse,"ou=".$name.",".$baseToUse,$type,true); -- 2.30.2