Skip to content

Using Match instance method on Filter? #300

@clader

Description

@clader

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions