Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.2.0

Bug #20142 Implement client side filtering for entries
Submitted: 2013-12-05 21:02 UTC
From: beni Assigned: beni
Status: Closed Package: Net_LDAP2 (version 2.0.12)
PHP Version: 5.5.6 OS: Linux Debian
Roadmaps: 2.1.0    
Subscription  


 [2013-12-05 21:02 UTC] beni (Benedikt Hallinger)
Description: ------------ It would be very handy if there was a function that implements a LDAP filtereing mechanism. This could be very useful for example when dealing with non directory sources like LDIF files, where one cannot execute an LDAP filter.

Comments

 [2013-12-05 21:11 UTC] beni (Benedikt Hallinger)
-Summary: Implement filtering for entries +Summary: Implement client side filtering for entries -Status: Open +Status: Closed -Assigned To: +Assigned To: beni
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. Got time and needed this urgently for an migration project here at work. So i took some time implementing this. The code is overall hopefully finished and stable, however only basic filtering is implemented so far. What works so far: - the operator "=" and its derivates (equals, begins, ends, contains) - combining filters with NOT, AND, OR; however deep you like (and php supports) What doesn't work: - Schema checking if entry is "online"; currently all is matched as string, not case sensitive; no matching rule (date match, number match, and the not so often used other ones) support so far - The operators >, >=, <, <= and ~= Test it in SVN and have fun! Example code: //$allEntries is an array containing various Net_LDAP2_Entry objects, for example red from LDIF or LDAP or just made up yourself... $filterresult = array(); // (optional!) $filter = Net_LDAP2_Filter::create('cn', 'begins', 'Simpson Ho'); $numOfMatches = $filter->matches($allEntries, $filterresult); // $numOfMatches contains an INT with the number of matched entries // $filterresult as optional parameter contains the matched entries