Code

Updated system saving
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 12 Jan 2010 09:14:25 +0000 (09:14 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 12 Jan 2010 09:14:25 +0000 (09:14 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15148 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/systems/admin/systems/class_systemManagement.inc

index a7e9df0de1f9b5bcef62160c3e76cf51ccac1b05..9bc5b486c033e3ef2d97130ee05ef4f00d2b0197 100644 (file)
@@ -448,7 +448,7 @@ class systemManagement extends management
 
         }else{
           $disallowed[] = $dn;
-          new log("security","groups/".get_class($this),$dn,array(),"Tried to trick deletion.");
+          new log("security","system/".get_class($this),$dn,array(),"Tried to trick deletion.");
         }
       }
     }
@@ -763,12 +763,57 @@ class systemManagement extends management
       unset($this->activationQueue[$this->last_dn]);
     }
 
+    /* Post handling for activated systems
+       target opsi -> Remove source.
+       target gosa -> Activate system.
+     */
+    if($this->last_tabObject instanceOf opsi_tabs){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->rmdir ($this->last_tabObject->dn);
+      @DEBUG(DEBUG_LDAP,__LINE__, __FUNCTION__, __FILE__,
+          "Source removed: ".$this->tabObject->dn,"<b>Opsi host activated</b>");
+
+      $hostId =  $this->last_tabObject->by_object['opsiGeneric']->hostId;
+      $mac    =  $this->last_tabObject->by_object['opsiGeneric']->mac;
+      $this->opsi->job_opsi_activate_client($hostId,$mac);
+
+    }elseif(isset($this->last_tabObject->was_activated) && $this->last_tabObject->was_activated){
+      $this->activate_new_device($this->last_tabObject->dn);
+    }
+
     // Avoid using values from an older input dialog
     $_POST = array();
     $this->handleActivationQueue();
   }
 
 
+  protected function applyChanges()
+  {
+    $str = management::applyChanges();
+    if($str) return($str);
+
+    /* Post handling for activated systems
+       target opsi -> Remove source.
+       target gosa -> Activate system.
+     */
+    if($this->tabObject instanceOf opsi_tabs){
+      $ldap = $this->config->get_ldap_link();
+      $ldap->cd($this->config->current['BASE']);
+      $ldap->rmdir ($this->tabObject->dn);
+      @DEBUG(DEBUG_LDAP,__LINE__, __FUNCTION__, __FILE__,
+          "Source removed: ".$this->tabObject->dn,"<b>Opsi host activated</b>");
+
+      $hostId =  $this->tabObject->by_object['opsiGeneric']->hostId;
+      $mac    =  $this->tabObject->by_object['opsiGeneric']->mac;
+      $this->opsi->job_opsi_activate_client($hostId,$mac);
+
+    }elseif(isset($this->tabObject->was_activated) && $this->tabObject->was_activated){
+      $this->activate_new_device($this->tabObject->dn);
+    }
+  }
+  
+
   /*! \brief  Sets FAIstate to "install" for "New Devices".
     This function is some kind of "Post handler" for activated systems,
     it is called directly after the object (workstabs,servtabs) gets saved.