Code

Updated logview. Display uid instead of dn.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 26 Nov 2007 12:48:48 +0000 (12:48 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 26 Nov 2007 12:48:48 +0000 (12:48 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7889 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/addons/logview/class_gosa_logview.inc

index 847800380854101df599512807472634e8a73190..786f8326b6bc7a27bb21dc4a5501654cc24cdfdd 100644 (file)
@@ -25,6 +25,9 @@ class gosa_logview extends plugin
 
   var $timezone_offset  = 0;
 
+  var $uid_map = array();
+  
+
   function gosa_logview (&$config, $dn= NULL)
   {
     /* Include config object */
@@ -34,12 +37,18 @@ class gosa_logview extends plugin
     /* Restore last filter settings */
     foreach(array("action","server","time","regex") as $attr){
       if(isset($_SESSION['logview']['gosa_log'][$attr])){
-       $this->$attr = $_SESSION['logview']['gosa_log'][$attr];
+        $this->$attr = $_SESSION['logview']['gosa_log'][$attr];
       }
     }
 
     $tz = get_default_timezone();
     $this->timezone_offset = $tz['value'] * 60 * 60 ;
+
+    $ldap = $this->config->get_ldap_link();
+    $ldap->search("(&(objectClass=person)(uid=*))",array("uid","dn"));
+    while($attrs = $ldap->fetch()){
+      $this->uid_map[$attrs['dn']] = $attrs['uid'][0];
+    }
   }
 
 
@@ -264,7 +273,12 @@ class gosa_logview extends plugin
           }
 
           $base = ", ".substr($this->config->current['BASE'],0,5)."...";
-          $user = preg_replace("/,".normalizePreg($this->config->current['BASE'])."/",$base,$line['user']);
+  
+          if(isset($this->uid_map[$line['user']])){
+            $user = $this->uid_map[$line['user']];
+          }else{
+            $user = preg_replace("/,".normalizePreg($this->config->current['BASE'])."/",$base,$line['user']);
+          }
           $object = preg_replace("/,".normalizePreg($this->config->current['BASE'])."/",$base,$line['object']);
 
           $res.=" <tr style=\"$col\">\n";