Code

Updated opsi clinet handling.
[gosa.git] / gosa-plugins / systems / admin / systems / class_systemManagement.inc
index 4372472751fb112fdce25d64b324099391d6322c..b85c44626bc3fad728d987d8b746ab082aa5e59b 100644 (file)
@@ -447,7 +447,7 @@ class systems extends plugin
       $this->dn= "new";
 
       $tabs = $this->get_tab_defs();
-
+  
       if(isset($tabs[$sw])){
         $class    = $tabs[$sw]["CLASS"];
         $tabname  = $tabs[$sw]["TABNAME"];
@@ -474,7 +474,6 @@ class systems extends plugin
       }
     }
 
-
     /********************
       System activation
      ********************/
@@ -1193,13 +1192,15 @@ class systems extends plugin
     /* Append opsi systems, the opsi extension have to installed.
      */
     if($this->opsi != NULL){
-      $res = array_merge($res,$this->opsi->get_hosts_for_system_management());
+      $opsi_clients = $this->opsi->get_hosts_for_system_management();
       if($this->opsi->is_error()){
         msg_dialog::display(_("Error"),msgPool::siError($this->opsi->get_error()),ERROR_DIALOG);
       }
     }
     
     /* Get all gotoTerminal's */
+    $t_id = 0;
+    $opsi_map  = array();
     foreach ($res as $value){
 
       $tmp= $value['dn'];
@@ -1234,7 +1235,7 @@ class systems extends plugin
       /* Detect type of object and create an entry for $this->terminals */
       $terminal = array();
 
-       if (in_array_ics('opsi_client', $value["objectClass"])){
+       if (0 && in_array_ics('gosa_opsi_client', $value["objectClass"])){
 
          /* check acl */
          $terminal             = $value;
@@ -1337,9 +1338,27 @@ class systems extends plugin
         }
       }
 
+      /* Append collected data to the host list.
+       */
       if(count($terminal)){
-        $this->terminals[]=$terminal;
+        $t_id ++ ;
+        $this->terminals[$t_id]=$terminal;
+        $opsi_map[preg_replace('/\$$/',"",$value['cn'][0])] = $t_id;
+      }
+    }
+
+
+    /* Merge real hosts with opsi hosts.
+       If there is a samba host, then merge it with the opsi host,
+        to avoid duplicate entries.
+     */
+    foreach($opsi_clients as $entry){
+      if(isset($opsi_map[$entry['cn'][0]])){
+        continue;
       }
+      $terminal             = $entry;
+      $terminal['type']     = "O";
+      $this->terminals[] = $terminal;
     }
 
     $tmp  =array();
@@ -1669,10 +1688,10 @@ class systems extends plugin
     if($this->opsi != NULL){
       $tabs["opsi_client"] = array(
           "CLASS"   => "OPSITABS",
-          "TABNAME" => "opsi_generic" ,
+          "TABNAME" => "opsigeneric" ,
           "TABCLASS"=> "opsi_tabs",
           "ACLC"    => "opsi" ,
-          "ACL"     => "opsi/opsi_generic");
+          "ACL"     => "opsi/opsigeneric");
     }
 
     return($tabs);