diff --git a/plugins/admin/fai/class_faiProfileEntry.inc b/plugins/admin/fai/class_faiProfileEntry.inc
index 80eccee5b8051cda64da86b2deeb74ccd836af08..30eedeb6cc1b51a7a461a2208c10c01124a91e35 100644 (file)
plugin::plugin ($config, $dn);
/* Search only in fai tree */
- $base = "ou=fai,ou=configs,ou=systems,".$_SESSION['faifilter']['base'];
+ $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){
/* If no search filter is set, create one */
if (!is_global("SUBfaifilter")){
- $SUBfaifilter= array("base" => "ou=fai,ou=configs,ou=systems,".$base, "Sregex" => "*");
+ $SUBfaifilter= array("base" => "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase'], "Sregex" => "*");
$SUBfaifilter['SShowTemplates'] = true;
$SUBfaifilter['SShowScripts'] = true;
$SUBfaifilter['SShowHooks'] = true;
/* Check if we used a checkboxe from the list, to select dselect an entry */
foreach($_POST as $name => $value){
foreach($this->FAIAllclasses as $class => $obj){
- if(isset($_POST["ON_PAGE_".$class])){
- if(isset($_POST['USE_'.$class])){
+ $bclass = base64_encode($class);
+ if(isset($_POST["ON_PAGE_".$bclass])){
+ if(isset($_POST['USE_'.$bclass])){
$this->FAIAllclasses[$class]['status']=true;
}else{
$this->FAIAllclasses[$class]['status']=false;
}
/* Append to list */
- $field1 = array("string"=> preg_replace("/%KEY%/",$usedClass,$action_check).$usedClass,"attach"=>"");
+ $field1 = array("string"=> str_replace("%KEY%",base64_encode($usedClass),$action_check).$usedClass,"attach"=>"");
$field2 = array("string"=> $str,"attach"=>"style='border-right:0px;'");
$divlist->AddEntry(array($field1,$field2));
}
/* Check supplied data */
function check()
{
- $message= array();
+ /* Call common method to give check the hook */
+ $message= plugin::check();
+
return ($message);
}