From 01e906423fba15a84da31e1c64e6b233a799ff3f Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 11 Apr 2008 08:34:58 +0000 Subject: [PATCH] Fixed askClassName (FAI) for new FAI objects -Could not create already deleted class. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10348 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../fai/admin/fai/class_askClassName.inc | 50 +++++++++++-------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/gosa-plugins/fai/admin/fai/class_askClassName.inc b/gosa-plugins/fai/admin/fai/class_askClassName.inc index c803e64dc..cde5eb966 100644 --- a/gosa-plugins/fai/admin/fai/class_askClassName.inc +++ b/gosa-plugins/fai/admin/fai/class_askClassName.inc @@ -45,30 +45,40 @@ class askClassName extends plugin $base = $faifilter['branch']; } $ldap = $this->config->get_ldap_link(); - - $res= get_list("(&(objectClass=organizationalUnit)(!(objectClass=FAIbranch)))", "fai", $base, - array("cn","description","objectClass"), GL_SIZELIMIT ); + + + $type_acl_mapping = array( + "FAIpartitionTable" => "faiPartitionTable", + "FAIpackageList" => "faiPackage", + "FAIscript" => "faiScript", + "FAIvariable" => "faiVariable", + "FAIhook" => "faiHook", + "FAIprofile" => "faiProfile", + "FAItemplate" => "faiTemplate"); + + $filter = ""; + foreach($type_acl_mapping as $map){ + $filter .= "(objectClass=".$map.")"; + } + + $res = FAI::get_all_objects_for_given_base($base,"(|".$filter.")",TRUE); $delete = array(); $used = array(); - foreach($res as $objecttypes){ - $res2= get_list("(objectClass=*)", "fai", $objecttypes['dn'], - array("cn","description","objectClass","FAIclass","FAIstate"), GL_SIZELIMIT | GL_CONVERT ); - foreach($res2 as $object){ - - /* skip class names with this name */ - if(in_array($this->objectClass,$object['objectClass']) || in_array("FAIprofile",$object['objectClass'])){ - if(isset($object['FAIstate'][0]) && preg_match("/removed$/",$object['FAIstate'][0])){ - continue; - } - $delete[] = $object['cn'][0]; + foreach($res as $object){ + + /* skip class names with this name */ + if(in_array($this->objectClass,$object['objectClass']) || in_array("FAIprofile",$object['objectClass'])){ + if(isset($object['FAIstate'][0]) && preg_match("/removed$/",$object['FAIstate'][0])){ + continue; } - - /* Skip profiles */ - if(!in_array("FAIprofile",$object['objectClass'])){ - if(isset($object['cn'])){ - $used[$object['cn'][0]]= $object['cn'][0]; - } + $delete[] = $object['cn'][0]; + } + + /* Skip profiles */ + if(!in_array("FAIprofile",$object['objectClass'])){ + if(isset($object['cn'])){ + $used[$object['cn'][0]]= $object['cn'][0]; } } } -- 2.30.2