Code

Only display those FAIobjects, that are in the currently edited release
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 26 Sep 2006 11:29:03 +0000 (11:29 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 26 Sep 2006 11:29:03 +0000 (11:29 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@4781 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/fai/class_faiProfileEntry.inc

index 3729141b80d197f34de51cbec317eb935df0a277..64d32597394f0e036a349e7d61e09fccbdf0c141 100644 (file)
@@ -20,20 +20,40 @@ class faiProfileEntry extends plugin
     plugin::plugin ($config, $dn);
 
     /* Search only in fai tree */
-    $base = "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
+    $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"));
 
-    /* Create array with categories to be able to sort different types of objects */
-    $categories = array("FAIscript","FAItemplate","FAIhook","FAIvariable","FAIpartitionTable","FAIpackageList");
+    $base= "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'];
+    if($_SESSION['faifilter']['branch']!="main"){
+      $base = $_SESSION['faifilter']['branch'];
+    }
 
-    /* Read out all objects from fai tree */
+    /* Get ldap connection */
     $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()){
-      
+
+    /* Capture objects from given base */
+    $result = array();
+    foreach($ObjectTypes as $oc => $data){
+      $ou = $data['OU'].$base;
+
+      $ldap->ls("(objectClass=".$oc.")",$ou,array("*"));
+      while($res = $ldap->fetch()){
+        $result[] = $res;
+      } 
+    }
+
+    /* Create array with categories to be able to sort different types of objects */
+    $categories = array("FAIscript","FAItemplate","FAIhook","FAIvariable","FAIpartitionTable","FAIpackageList");
+    $sort = array();
+    foreach($result as $attrs){   
+   
       /* Only use objects which have cn set */
       if((isset($attrs['cn'][0]))&&(!in_array($attrs['cn'][0],$used))){
         foreach($categories as $cat){