Code

Fixed class detection for FAI-Profiles
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 21 Nov 2007 08:50:59 +0000 (08:50 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 21 Nov 2007 08:50:59 +0000 (08:50 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7838 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/fai/class_faiProfileEntry.inc

index 56e74f96cbac2aa3ddfa4a9a0b895a62b71c5ed1..2d9b0976458f0bd8f23fd7232de5b0eb2bdc0af2 100644 (file)
@@ -22,9 +22,17 @@ class faiProfileEntry extends plugin
 
     /* Search only in fai tree */
     $base = "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
-
+    if($_SESSION['faifilter']['branch']!="main"){
+      $base = $_SESSION['faifilter']['branch'];
+    }
+  
     $this->ui = get_userinfo();
 
+    $filter = "(|(objectClass=FAIscript)(objectClass=FAItemplate)(objectClass=FAIhook)".
+                "(objectClass=FAIvariable)(objectClass=FAIpartitionTable)(objectClass=FAIpackageList))";
+
+    $FAI_objects = get_all_objects_for_given_base($base,$filter,true);
+
     /* Create array with categories to be able to sort different types of objects */
     $categories = array("FAIscript"         => "faiScript",
                         "FAItemplate"       => "faiTemplate",
@@ -36,22 +44,22 @@ class faiProfileEntry extends plugin
     /* Read out all objects from fai tree */
     $ldap= $this->config->get_ldap_link();
     $ldap->cd($base);
-    $ldap->search("(| (objectClass=FAIscript)(objectClass=FAItemplate)(objectClass=FAIhook)(objectClass=FAIvariable)
-                      (objectClass=FAIpartitionTable)(objectClass=FAIpackageList))",array("*"));
-    
     $sort=array();
-    while($attrs = $ldap->fetch()){
-      
+    foreach($FAI_objects as $obj){
+
+      $ldap->cat($obj['dn']);
+      $attrs = $ldap->fetch();
+
       /* Only use objects which have cn set */
       if((isset($attrs['cn'][0]))&&(!in_array($attrs['cn'][0],$used))){
         foreach($categories as $cat => $acl){
           if(in_array($cat,$attrs['objectClass'])){
-        
+
             $acl =  $this->ui->get_permissions($attrs['dn'],"fai/".$acl); 
 
             /* Append different types of objects */
             $this->FAIAllclasses[$attrs['cn'][0]]['objects'][$cat]=$cat;
-      
+
             if(!isset($this->FAIAllclasses[$attrs['cn'][0]]['acl'])){
               $this->FAIAllclasses[$attrs['cn'][0]]['acl']="";
             }
@@ -62,7 +70,7 @@ class faiProfileEntry extends plugin
 
             $sort[strtolower($attrs['cn'][0])] = $attrs['cn'][0];
           }
-        }
+        } 
       }
     }