From 3cd11aa4fca0307dc7fa37dc51bafa0c493b39d9 Mon Sep 17 00:00:00 2001 From: psc Date: Thu, 4 Mar 2010 14:02:56 +0000 Subject: [PATCH] Apply fix for #3750 - Move gathering of all FAI classes to an own function, because it should really be limited to the FAI classes that are part of the current release or inheritted releases. - Use FAI::get_all_objects_for_given_base to get the list of FAI classes and limit the scope to the current FAI release. This way the list only has those FAI classes which we have in the current release or could inherit. This fixes a bug with displaying wrong symbols in some conditions. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@16073 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../fai/admin/fai/class_faiProfile.inc | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/trunk/gosa-plugins/fai/admin/fai/class_faiProfile.inc b/trunk/gosa-plugins/fai/admin/fai/class_faiProfile.inc index 3daa2424d..e146a9121 100644 --- a/trunk/gosa-plugins/fai/admin/fai/class_faiProfile.inc +++ b/trunk/gosa-plugins/fai/admin/fai/class_faiProfile.inc @@ -27,8 +27,7 @@ class faiProfile extends plugin { /* Load Attributes */ plugin::plugin ($config, $dn); - $ldap=$this->config->get_ldap_link(); - + $this->ui = get_userinfo(); /* Parse ldap attribute to get all assigned classes */ @@ -48,6 +47,21 @@ class faiProfile extends plugin } } + + if($dn != "new"){ + $this->dn =$dn; + } + $this->old_cn = $this->cn; + } + + function get_all_fai_classes() + { + if (count($this->FAIAllclasses)) { + return; + } + + $ldap=$this->config->get_ldap_link(); + $categories = array("FAIscript","FAItemplate","FAIhook","FAIvariable","FAIpartitionTable","FAIpackageList"); /* Build filter */ @@ -56,15 +70,10 @@ class faiProfile extends plugin $filter.= "(objectClass=$cat)"; } - /* Get ldap connection */ - $base = session::get('CurrentMainBase'); - $ldap->cd($base); $sort = array(); - /* search all FAI classes */ - $ldap->search("(|$filter)",array("*")); - while($attrs = $ldap->fetch()){ - + $res = FAI::get_all_objects_for_given_base($this->parent->parent->fai_release, "(|$filter)", true); + foreach($res as $attrs){ /* Sort by categorie */ foreach($categories as $cat){ if(in_array($cat,$attrs['objectClass'])){ @@ -89,11 +98,6 @@ class faiProfile extends plugin /* Assign sorted classes */ $this->FAIAllclasses = array(); $this->FAIAllclasses = $tmp; - - if($dn != "new"){ - $this->dn =$dn; - } - $this->old_cn = $this->cn; } function acl_base_for_current_object($dn) @@ -320,6 +324,8 @@ class faiProfile extends plugin $str = " "; $act = ""; + $this->get_all_fai_classes(); + if(isset($this->FAIAllclasses[$usedClass])){ foreach($this->FAIAllclasses[$usedClass] as $class => $obj){ $str.= $objTypes[$class]; -- 2.30.2