From: hickert Date: Wed, 21 Nov 2007 08:50:59 +0000 (+0000) Subject: Fixed class detection for FAI-Profiles X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=882a253a0fa4d1dbbf47cfb728ad7c4774984c7b;p=gosa.git Fixed class detection for FAI-Profiles git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7838 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/fai/class_faiProfileEntry.inc b/plugins/admin/fai/class_faiProfileEntry.inc index 56e74f96c..2d9b09764 100644 --- a/plugins/admin/fai/class_faiProfileEntry.inc +++ b/plugins/admin/fai/class_faiProfileEntry.inc @@ -22,9 +22,17 @@ class faiProfileEntry extends plugin /* Search only in fai tree */ $base = "ou=fai,ou=configs,ou=systems,".$_SESSION['CurrentMainBase']; - + if($_SESSION['faifilter']['branch']!="main"){ + $base = $_SESSION['faifilter']['branch']; + } + $this->ui = get_userinfo(); + $filter = "(|(objectClass=FAIscript)(objectClass=FAItemplate)(objectClass=FAIhook)". + "(objectClass=FAIvariable)(objectClass=FAIpartitionTable)(objectClass=FAIpackageList))"; + + $FAI_objects = get_all_objects_for_given_base($base,$filter,true); + /* Create array with categories to be able to sort different types of objects */ $categories = array("FAIscript" => "faiScript", "FAItemplate" => "faiTemplate", @@ -36,22 +44,22 @@ class faiProfileEntry extends plugin /* Read out all objects from fai tree */ $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()){ - + foreach($FAI_objects as $obj){ + + $ldap->cat($obj['dn']); + $attrs = $ldap->fetch(); + /* Only use objects which have cn set */ if((isset($attrs['cn'][0]))&&(!in_array($attrs['cn'][0],$used))){ foreach($categories as $cat => $acl){ if(in_array($cat,$attrs['objectClass'])){ - + $acl = $this->ui->get_permissions($attrs['dn'],"fai/".$acl); /* Append different types of objects */ $this->FAIAllclasses[$attrs['cn'][0]]['objects'][$cat]=$cat; - + if(!isset($this->FAIAllclasses[$attrs['cn'][0]]['acl'])){ $this->FAIAllclasses[$attrs['cn'][0]]['acl']=""; } @@ -62,7 +70,7 @@ class faiProfileEntry extends plugin $sort[strtolower($attrs['cn'][0])] = $attrs['cn'][0]; } - } + } } }