Code

Apply patch for 1797 from mba
[gosa.git] / trunk / gosa-core / include / class_log.inc
index bbe31517e228cac1741b3768d6782ddf371138fd..ed93a631ce0f32a99f4ff83a39cabeff0aabea6e 100644 (file)
@@ -76,7 +76,7 @@ class log {
     $entry['changes']   = $changes;
     $entry['result']    = $result;
 
-    if(!isset($config) || ( $this->config->get_cfg_value("logging") == ""  && empty($entry['user']))){
+    if(!isset($this->config) || ( $this->config->get_cfg_value("logging") == ""  && empty($entry['user']))){
       $entry['user']  = "unknown";
     }
  
@@ -90,7 +90,7 @@ class log {
       
     }else{
 
-      if (isset ($config)){
+      if (isset ($this->config)){
         if ($this->config->get_cfg_value("logging") == ""){
           $this->log_into_syslog($entry);
         }else{
@@ -157,6 +157,26 @@ class log {
 
       $error = "";
    
+      /* Check GosaUnitTag
+       */
+      global $config;
+      $ui = get_userinfo();
+      if (isset($config->current['HONOURUNITTAGS']) &&
+                preg_match('/true/i', $config->current['HONOURUNITTAGS']) &&
+                $ui->gosaUnitTag != '') { 
+        $ldap = $this->config->get_ldap_link() ;
+        $ldap->cd($this->config->current['BASE']);
+        $ldap->search("(&(&(objectClass=gosaLogServer)(gosaUnitTag=$ui->gosaUnitTag)(cn=$server_name)))");
+
+        if (!$ldap->count()){      
+          /* Remove server from config
+           */
+          unset($config->data['SERVERS']['LOGGING'][$server_name]);  
+          $this->config = $config;
+          continue;
+        }
+      }
+
       /* Connect to the database 
        */
       $con = @mysql_pconnect($server_name,$server['USER'],$server['PWD']);