Code

Updated FAI tp list opsi stuff again
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 6 Jan 2010 10:17:13 +0000 (10:17 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 6 Jan 2010 10:17:13 +0000 (10:17 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15078 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/fai/admin/fai/class_faiManagement.inc
gosa-plugins/fai/admin/fai/class_filterFAI.inc

index 9a9b232e8253083504e49dfc376594ca5adc842c..bc0fef35e34c983104be63821faa501755ecddb4 100644 (file)
@@ -874,6 +874,33 @@ class faiManagement extends management
     }
     return(array());
   }
+
+
+  /* Check if the given FAI class is used in this release
+   */
+  static function check_class_name($oc,$name,$dn)
+  {
+    $base = FAI::get_release_dn($dn);
+
+    if($oc == "FAIprofile"){
+      $f = "";
+      $ocs = array("FAIprofile","FAItemplate","FAIhook","FAIpartitionTable","FAIpackageList","FAIscript","FAIvariable");
+      foreach($ocs as $oc){
+        $f .= "(objectClass=".$oc.")";
+      }
+      $res  = FAI::get_all_objects_for_given_base($base,"(|".$f.")",TRUE);
+    }else{
+      $res  = FAI::get_all_objects_for_given_base($base,"(objectClass=".$oc.")",TRUE);
+    }
+    $delete = array();
+    $used   = array();
+    foreach($res as $object){
+      $used[$object['cn'][0]]= $object['cn'][0];
+    }
+    return($used);
+  }
+
+
 } 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
index 49d6d9a54b09278613d6123d40ad413aa06c31d7..c8d8ef6f34bc1829c0c89c8578cf49cc3fdb4546 100644 (file)
@@ -89,6 +89,58 @@ class filterFAI extends filterLDAP{
       $entries[] = $item;
     }
 
+
+    // Append opsi stuff ... 
+    $opsi = new opsi($config);
+
+    if($opsi instanceof opsi && $opsi->enabled()){
+      $opsi_acl = $ui->get_permissions($base,"opsi/opsiProperties");
+      if(preg_match("/r/",$opsi_acl)){
+        $err = FALSE;
+        $n_pro = $opsi->get_netboot_products();
+        $err |= $opsi->is_error();
+        foreach($n_pro as $name => $data){
+          $entry = array(
+              "cn" => $name,
+              "description" => $data['DESC'],
+              "type" => "opsi_netboot");
+          $objects[$name]['opsi_netboot'] = $entry;
+        }
+        $l_pro = $opsi->get_local_products();
+        $err |= $opsi->is_error();
+        foreach($l_pro as $name => $data){
+          $entry = array("cn" => $name,
+              "description" => $data['DESC'],
+              "type" => "opsi_local");
+          $objects[$name]["opsi_local"] = $entry;
+        }
+        if($err){
+          msg_dialog::display(_("Error"),msgPool::siError($opsi->get_error()),ERROR_DIALOG);
+        }
+      }
+    }
+
+    foreach($objects as $name => $data)
+    {
+      $data = array_pop($data);
+      $item =array();
+
+      // FAKE_OC_IsBranch allows us to delete this entry (indicates NOT freezed state)
+      $item['objectClass']  = array('count' => 2, $data['type'], "FAKE_OC_IsBranch"); 
+      $item[] = 'objectClass';
+      $item['cn']  = $data['cn'];
+      $item[] = 'cn';
+      $item['description']  = $data['description'];
+      $item[] = 'description';
+      $item['dn']  = $data['cn'];
+      $item[] = 'dn';
+      $item['TYPES']  = array($data['type']);
+      $item[] = 'TYPES';
+      $item['count'] = '5';
+      $entries[] = $item;  
+      
+    }
+
     return($entries);
   }
 }