-
Notifications
You must be signed in to change notification settings - Fork 253
Description
Can anyone provide any documentation or examples of the proper/intended use of the match instance method on Filter?
(http://www.rubydoc.info/github/ruby-ldap/ruby-net-ldap/Net/LDAP/Filter#match-instance_method)
I was hoping that I could take a returned object (or array of objects) and use match to apply a constructed Filter against those objects (sort of a mini search against objects that were already returned, instead of searching the LDAP server again). Or at least validate that a single returned objects matches a constructed filter.
I tried doing something like:
myResults = ldap.search( :base => treebase, :scope => Net::LDAP::SearchScope_WholeSubtree, :filter => search_filter, :attributes =>result_attrs, :return_result => true)
me = myResults.first
test_search_filter = Net::LDAP::Filter.construct("(mail=some.email@test.com)")
test_search_filter.match(me)
Which gives me either nil (when it doesn't match whats in the result object), or an integer (0-7) if it does (not sure what the different int values mean).
... but if I try a more complex filter like:
myResults = ldap.search( :base => treebase, :scope => Net::LDAP::SearchScope_WholeSubtree, :filter => search_filter, :attributes =>result_attrs, :return_result => true)
me = myResults.first
test_search_filter = Net::LDAP::Filter.construct("(&(givenName=Fred)(sn=Smith))")
test_search_filter.match(me)
.. then I get an
Unknown filter type in match: and (Net::LDAP::FilterTypeUnknownError)
Is there any guidance anywhere on what match is exactly, and what it's intended for?
Thanks
~Calder