Code

Enabled extra opsi host qurey
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 15 Mar 2010 16:44:05 +0000 (16:44 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 15 Mar 2010 16:44:05 +0000 (16:44 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@16541 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/systems/admin/systems/class_filterOPSIHOSTS.inc
gosa-plugins/systems/admin/systems/system-filter.xml

index 767fe0cfd63bdd04c49b229751b7abaaa343424b..d8e47a892dae0ae10d6a1330e7fe1380e3c15a78 100644 (file)
@@ -7,19 +7,18 @@ class filterOPSIHOSTS {
     // Append opsi stuff ...
     global $config;
     $ui = get_userinfo();
+    $entries = array();
 
-    echo $filter;
 
-    if(preg_match("/NETBOOT/", $filter) && 
-        class_available('opsi') &&
-        $base == $config->current['BASE']){
+        
 
-      // Get filter regex ...
-      $regex = "";
-      if(preg_match("/\(cn=[^\)\$]*\)/", $filter)){
-        $regex = trim(preg_replace("/^.*\(cn=([^\)\$]*)\).*$/","\\1", $filter),"* ");
-      }
+    if(class_available('opsi') && $base == $config->current['BASE']){
 
+      $attr = $value = "";
+      if(preg_match("/=/", $filter)) {
+        list($fAttr,$fValue) = preg_split("/=/", $filter);
+      }
+      
       // Check ACLs and opsi handle
       $opsi_acl = $ui->get_permissions($base,"opsi/opsiProperties");
       $opsi = new opsi($config);
@@ -32,7 +31,8 @@ class filterOPSIHOSTS {
           msg_dialog::display(_("Error"),msgPool::siError($opsi->get_error()),ERROR_DIALOG);
         }else{
           foreach($opsi_clients as $entry){
-            if(empty($regex) || preg_match('/'.preg_quote($regex,'/').'/i',$entry['cn'][0])){
+
+            if(empty($fAttr) || preg_match("/{$fValue}/i",$entry[$fAttr][0])){
               $entry['objectClass'] = array("FAKE_OC_OpsiHost");
               $item = array('count' => count($entry));
               foreach($entry as  $name => $value){
index 380c57ab9ec4e38b089e40877d333d80b3b43242..1f24590bccd6b25aedcb2e35ce8fcb8fa0341e06 100644 (file)
@@ -26,7 +26,7 @@
     </query>
     <query>
       <backend>OPSIHOSTS</backend>
-      <filter>$</filter>
+      <filter>cn=$</filter>
     </query>
     <autocomplete>
       <attribute>cn</attribute>