Code

Apply patch for 1797 from mba
authorpsc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 29 Jun 2010 13:06:24 +0000 (13:06 +0000)
committerpsc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 29 Jun 2010 13:06:24 +0000 (13:06 +0000)
In the logging function pay respect to the gosa unittags
by filtering the servers on the fly and removing servers
if they don't match the unittag (to avoid another LDAP
query the next time)

git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@18863 594d385d-05f5-0310-b6e9-bd551577e9d8

trunk/gosa-core/include/class_log.inc

index 4b846e5722e26f1811178f9ba6aac370a5a51eb7..ed93a631ce0f32a99f4ff83a39cabeff0aabea6e 100644 (file)
@@ -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']);