Code

Fixed askClassName (FAI) for new FAI objects
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 11 Apr 2008 08:34:58 +0000 (08:34 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 11 Apr 2008 08:34:58 +0000 (08:34 +0000)
-Could not create already deleted class.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10348 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/fai/admin/fai/class_askClassName.inc

index c803e64dc49e1bbf34206ba3a38604d138ab8c3b..cde5eb96604a8d5a009b8b7ce150d78d8e171414 100644 (file)
@@ -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];
         }
       }
     }