From: hickert Date: Tue, 26 Sep 2006 11:29:03 +0000 (+0000) Subject: Only display those FAIobjects, that are in the currently edited release X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ee041b5b8316eed6adcd4118d927b759ad406a86;p=gosa.git Only display those FAIobjects, that are in the currently edited release git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@4781 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/fai/class_faiProfileEntry.inc b/plugins/admin/fai/class_faiProfileEntry.inc index 3729141b8..64d325973 100644 --- a/plugins/admin/fai/class_faiProfileEntry.inc +++ b/plugins/admin/fai/class_faiProfileEntry.inc @@ -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){