GithubHelp home page GithubHelp logo

Comments (4)

mcavage avatar mcavage commented on May 23, 2024

Howdy,

Yeah, perfect - so if they're sending "compound" filters you kind of have to introspect the filter to see what type it is. Here's a complex example of doing it in the riak backend I wrote: https://github.com/mcavage/node-ldapjs-riak/blob/master/lib/search.js#L86

That said, if you're sure they're only going to send and and or filters, just do this:

var address = req.filter.filters && req.filter.filters.length ? req.filter.filters[0].value : req.filter.value;

Basically if it's an and|or filter, it will have a filters property, which is an array, and judging by wat you sent they should be "simple" filters at that point.

You probably don't want to do a regex, in case the value has a whacky character in it. Let me know if that helps.

m

from node-ldapjs.

tttp avatar tttp commented on May 23, 2024

Hi,

actually, my example were incorrect, was xavier* instead of xavier (so that's in initial instead of value). And the one from outlook generated a filters[0].filters...

anyway, went for a regex at the end (yeap I know, now I have two problems ;)

var address = req.filter.toString().match(/(\w.?=(._?)_)/);
and address[1] is so far good enough.

To be continued...

from node-ldapjs.

mcavage avatar mcavage commented on May 23, 2024

Hey Xavier,

Well, if it's a substring filter - is it sending *xavier* or xavier*? Basically, you could look at ldapjs/lib/filters/substr_filter.js and grab one of the properties depending on how it's being set. Or just regex ;)

m

from node-ldapjs.

tttp avatar tttp commented on May 23, 2024

Well, if it's a substring filter - is it sending *xavier* or xavier*?

For the autocomplete, it seems to be xavier*. ldap.js is super useful to
check out what the clients send. It seems to be a bit "creative".

Basically, you could look at ldapjs/lib/filters/substr_filter.js and grab
one of the properties depending on how it's being set. Or just regex ;)

So, I'm having it running for a beta and tracking the queries for a while
seeing what I'm catching and what I'm missing... to be continued.

So far, the biggest issue seems to be that some version of thunderbird are
denial of servicing me (firering a ldap query at every keystroket). I'm not
sure if I should skip all queries of less than 2 chars or if I throttle
somehow (eg. queue the queries and don't run the old one if a new one comes
in less than x ms)

Testing...

from node-ldapjs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.