Code

Enabled autocompleter for opsiLicenses
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 5 Jan 2010 10:10:55 +0000 (10:10 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 5 Jan 2010 10:10:55 +0000 (10:10 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15046 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/opsi/admin/opsiLicenses/class_filterOpsiLicense.inc
gosa-plugins/opsi/admin/opsiLicenses/opsiLicense-filter.xml

index 368aeafb61ac6582b54a2b552272df1a65aaa817..e2998f61a782c635dc9c192ab0ee98dfa401f7b9 100644 (file)
@@ -3,6 +3,25 @@
 class filterOpsiLicense {
 
   static function query($base, $scope, $filter, $attributes, $category, $objectStorage= "")
+  {
+    $config= session::global_get('config');
+    $ldap= $config->get_ldap_link(TRUE);
+    $flag= ($scope == "sub")?GL_SUBSEARCH:0;
+    $result= filterOpsiLicense::get_list($base, $filter, $attributes, $category, $objectStorage, $flag);
+
+    // Simple filtering 
+    if(!empty($filter)){
+      foreach($result as $key => $entry){
+        if(!preg_match($filter, $entry['cn'][0])){
+          unset($result[$key]);
+        }
+      }
+    }
+
+    return(filterACL::unifyResult($result));
+  }
+
+  static function get_list($base, $filter, $attributes, $category, $objectStorage, $flags= GL_SUBSEARCH)
   {
     $config= session::global_get('config');
     $si = new opsiLicenceHandler($config);
@@ -30,7 +49,7 @@ class filterOpsiLicense {
         $result[] = $entry;
       }
     }
-    return(filterACL::unifyResult($result));
+    return($result);
   }
 
   static function unifyResult($result)
index 220ee4025747300d80030e9df34821d9da9915be..7abcde7e664bfb39733c04fd73e0a6a3204f25eb 100644 (file)
@@ -10,7 +10,7 @@
   <search>
     <query>
       <backend>OpsiLicense</backend>
-      <filter>(&amp;(objectClass=fake_opsiLicense)$NAME)</filter>
+      <filter>$NAME</filter>
       <attribute>dn</attribute>
       <attribute>objectClass</attribute>
       <attribute>cn</attribute>
     <maxlength>60</maxlength>
     <default></default>
     <unset></unset>
-    <set>(cn=*$*)</set>
+    <set>/$/i</set>
     <alphabet>false</alphabet>
     <autocomplete>
       <backend>OpsiLicense</backend>
-      <filter>(&amp;(objectClass=fake_opsiLicense)(cn=*$NAME*))</filter>
+      <filter>/$NAME/i</filter>
       <attribute>cn</attribute>
       <frequency>0.5</frequency>
       <characters>3</characters>