Code

filter opsi hosts too
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 12 Jan 2010 13:22:18 +0000 (13:22 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 12 Jan 2010 13:22:18 +0000 (13:22 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15161 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index 22010af058aafb5ce91df6f870f7e7e9a0f6c152..8a620e5a75774a4a96c2d17e629dcf1a06b5a5b4 100644 (file)
@@ -106,6 +106,12 @@ class filterSYSTEMS {
         class_available('opsi') &&
         $base == $config->current['BASE']){
 
+      // Get filter regex ...
+      $regex = "";
+      if(preg_match("/\(cn=[^\)\$]*\)/", $filter)){
+        $regex = trim(preg_replace("/^.*\(cn=([^\)\$]*)\).*$/","\\1", $filter),"* ");
+      }
+
       // Check ACLs and opsi handle
       $opsi_acl = $ui->get_permissions($base,"opsi/opsiProperties");
       $opsi = new opsi($config);
@@ -118,13 +124,15 @@ class filterSYSTEMS {
           msg_dialog::display(_("Error"),msgPool::siError($opsi->get_error()),ERROR_DIALOG);
         }else{
           foreach($opsi_clients as $entry){
-            $entry['objectClass'] = array("FAKE_OC_OpsiHost");
-            $item = array('count' => count($entry));
-            foreach($entry as  $name => $value){
-              $item[] = $name;
-              $item[$name] = $value;
+            if(empty($regex) || preg_match('/'.preg_quote($regex,'/').'/i',$entry['cn'])){
+              $entry['objectClass'] = array("FAKE_OC_OpsiHost");
+              $item = array('count' => count($entry));
+              foreach($entry as  $name => $value){
+                $item[] = $name;
+                $item[$name] = $value;
+              }
+              $entries[] = $item;
             }
-            $entries[] = $item;
           }
         }
       }