diff --git a/plugins/admin/fai/class_faiProfileEntry.inc b/plugins/admin/fai/class_faiProfileEntry.inc
index 3729141b80d197f34de51cbec317eb935df0a277..30eedeb6cc1b51a7a461a2208c10c01124a91e35 100644 (file)
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," ),
+ "FAIpackageList" => array("OU"=>"ou=packages," ),
+ "FAIscript" => array("OU"=>"ou=scripts," ),
+ "FAIvariable" => array("OU"=>"ou=variables," ),
+ "FAIhook" => array("OU"=>"ou=hooks," ),
+ "FAIprofile" => array("OU"=>"ou=profiles," ),
+ "FAItemplate" => array("OU"=>"ou=templates," ));
- /* 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("cn","objectClass","dn"));
+ 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){