Code

Fixed faiProfile
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 26 Sep 2006 11:38:12 +0000 (11:38 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 26 Sep 2006 11:38:12 +0000 (11:38 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@4782 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/fai/class_faiProfile.inc
plugins/admin/fai/class_faiProfileEntry.inc

index 65871611b31db6f43195d4ea74c3c9d924ceaa8b..21e9be99ee4ed590c5a933d35b9f8eaa07e00280 100644 (file)
@@ -69,36 +69,37 @@ class faiProfile extends plugin
       }
     }
 
-    $categories = array("FAIscript","FAItemplate","FAIhook","FAIvariable","FAIpartitionTable","FAIpackageList");
-
-    /* Build filter */
-    $filter= "";
-    foreach ($categories as $cat){
-      $filter.= "(objectClass=$cat)";
+    /* Search only in fai tree */
+    $ObjectTypes = array(
+        "FAIpartitionTable"  => array("OU"=>"ou=disk,"       , "CHKBOX"=>"ShowPartitions"),
+        "FAIpackageList"     => array("OU"=>"ou=packages,"    , "CHKBOX"=>"ShowPackages"),
+        "FAIscript"          => array("OU"=>"ou=scripts,"     , "CHKBOX"=>"ShowScripts"),
+        "FAIvariable"        => array("OU"=>"ou=variables,"   , "CHKBOX"=>"ShowVariables"),
+        "FAIhook"            => array("OU"=>"ou=hooks,"       , "CHKBOX"=>"ShowHooks"),
+#        "FAIprofile"         => array("OU"=>"ou=profiles,"    , "CHKBOX"=>"ShowProfiles"),
+        "FAItemplate"        => array("OU"=>"ou=templates,"   , "CHKBOX"=>"ShowTemplates"));
+
+    $base= "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
+    if($_SESSION['faifilter']['branch']!="main"){
+      $base = $_SESSION['faifilter']['branch'];
     }
-    
-    /* Get ldap connection */ 
-    $base = $_SESSION['CurrentMainBase'];
-    $ldap->cd($base);
-    $sort = array();
 
-    /* search all FAI classes */
-    $ldap->search("(|$filter)",array("*"));
-    while($attrs = $ldap->fetch()){
+    /* Get ldap connection */
+    $ldap= $this->config->get_ldap_link();
+    $ldap->cd($base);
 
-      /* Sort by categorie */
-      foreach($categories as $cat){
-        if(in_array($cat,$attrs['objectClass'])){
+    /* Capture objects from given base */
+    $result = array();
+    foreach($ObjectTypes as $oc => $data){
+      $ou = $data['OU'].$base;
 
-          /* Append entry */
-          $this->FAIAllclasses[$attrs['cn'][0]][$cat]=$attrs;
-  
-          /* Create sort array, because the array above is a multidimensional array, and can't be sorted by php sorting functions*/
-          $sort[strtolower($attrs['cn'][0])] = $attrs['cn'][0];
-        }
+      $ldap->ls("(objectClass=".$oc.")",$ou,array("cn","objectClass","dn"));
+      while($attrs = $ldap->fetch()){
+        $this->FAIAllclasses[$attrs['cn'][0]][$oc]=$attrs;
+        $sort[strtolower($attrs['cn'][0])] = $attrs['cn'][0];
       }
-    } 
-
+    }
+  
     /* Sort the sort array */
     //ksort($sort);
 
index 64d32597394f0e036a349e7d61e09fccbdf0c141..55dec8721ec4240285c621f1f9a165055f973e54 100644 (file)
@@ -43,7 +43,7 @@ class faiProfileEntry extends plugin
     foreach($ObjectTypes as $oc => $data){
       $ou = $data['OU'].$base;
 
-      $ldap->ls("(objectClass=".$oc.")",$ou,array("*"));
+      $ldap->ls("(objectClass=".$oc.")",$ou,array("cn","objectClass","dn"));
       while($res = $ldap->fetch()){
         $result[] = $res;
       }