Code

Application branch problems
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 22 Mar 2006 08:32:35 +0000 (08:32 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 22 Mar 2006 08:32:35 +0000 (08:32 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2885 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_ldap.inc
plugins/admin/fai/class_faiManagement.inc

index 5bc19ed63bd51db031d71ccab7cff2d0b38da5db..70b1a09f50a276db0fa90966a87b51698bdc8e2a 100644 (file)
@@ -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 "<font style='font-size:11px;'><h4>".
               sprintf(_("Creating duplicate of %s in %s"),"<br><i>".$sourcedn."</i><br>","<br><i>".$destinationdn."</i><br>")."</h4>";
@@ -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));
index 64f68a7e02b09a1fe89544d80803def1195604cb..51bfdb119668d47af8d1b92887746e43a4ba85c5 100644 (file)
@@ -419,9 +419,15 @@ class faiManagement extends plugin
         $baseToUse = $_SESSION['faifilter']['branch'];
       }
 
+
+      $appsrc = preg_replace("/ou=fai,ou=configs,ou=systems,/","ou=apps,",$baseToUse)."<br>" ; 
+      $appdst = preg_replace("/ou=fai,ou=configs,ou=systems,/","ou=apps,","ou=".$name.",".$baseToUse)."<br>" ; 
+
       $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);