# Ruby LDAP --- Hooray!

**URL:** <https://www.ruby-forum.com/t/ruby-ldap-hooray/100357>\
**Category:** Ruby\
**Created:** [July 28, 2006, 3:58pm UTC](https://www.ruby-forum.com/t/ruby-ldap-hooray/100357 "2006-07-28T15:58:45Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![gregarican](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/7feea3/32.png) [@gregarican](https://www.ruby-forum.com/u/gregarican)\
**Post date:** [July 28, 2006, 3:58pm UTC](https://www.ruby-forum.com/t/ruby-ldap-hooray/100357/1 "2006-07-28T15:58:45Z")

</div>

After unsuccessfully trying to compile a Ruby LDAP implementation a  
year or so ago I found another project on Rubyforge  
([http://rubyforge.org/projects/net-ldap/](http://rubyforge.org/projects/net-ldap/)) that easily accomplished the  
task in my Windows One-Click Installer Ruby environment. It was as easy  
as typing in ruby setup.rb! I am so thankful for the good work  
performed by the project maintainer(s) and wanted to express this. Now  
I can work on automating some spam filtering with my upstream mail  
scanning host. And do so using Ruby rather than an alternative  
language. Once again, thanks for the job well done!

---

<div class="post-metadata">

**Author:** ![gregarican](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/7feea3/32.png) [@gregarican](https://www.ruby-forum.com/u/gregarican)\
**Post date:** [July 28, 2006, 4:18pm UTC](https://www.ruby-forum.com/t/ruby-ldap-hooray/100357/2 "2006-07-28T16:18:22Z")

</div>

Thanks. Let us know here if you hit any problems with the library or  
if you have any feature requests. Sounds like you may be doing more  
with Net::LDAP than just bind-authenticating users, so I’ll be curious  
to follow your progress.

---

<div class="post-metadata">

**Author:** ![gregarican](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/7feea3/32.png) [@gregarican](https://www.ruby-forum.com/u/gregarican)\
**Post date:** [July 28, 2006, 4:32pm UTC](https://www.ruby-forum.com/t/ruby-ldap-hooray/100357/3 "2006-07-28T16:32:34Z")

</div>

For this one task all I am doing is pulling the Exchange Server global  
address book through LDAP and uploading the derived list to an upstream  
provider that helps us filter out spam e-mail messages. It’s just a  
quick pull and the library you have made things a snap. It’s all done  
now.

There was another project I was considering moving to LDAP. Right now I  
have a mobile CRM app that uses Exchange CDO for storing the contact  
details. Rather than use this (clunky) storage method I am thinking  
about moving the contact store over to an lighter weight LDAP tree. I  
have OpenLDAP Server on my development box and did some modeling of how  
things would work. Seems like a good possibility down the road  
sometime. Right now things work fine in regards to what’s already been  
done. It’s just a fine tuning matter to improve things whenever I find  
the time.

---

<div class="post-metadata">

**Author:** ![gregarican](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/7feea3/32.png) [@gregarican](https://www.ruby-forum.com/u/gregarican)\
**Post date:** [July 28, 2006, 4:39pm UTC](https://www.ruby-forum.com/t/ruby-ldap-hooray/100357/4 "2006-07-28T16:39:13Z")

</div>

Out of curiosity, what kind of identities are you storing in Exchange  
(and maybe LDAP someday) to support your mobile CRM? are they people  
who work for your company? or people who are your company’s  
customers/vendors/partners?

(I ask because I’m thinking ahead about some business-oriented  
enhancements to the LDAP library.)

---

<div class="post-metadata">

**Author:** ![gregarican](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/7feea3/32.png) [@gregarican](https://www.ruby-forum.com/u/gregarican)\
**Post date:** [July 28, 2006, 4:46pm UTC](https://www.ruby-forum.com/t/ruby-ldap-hooray/100357/5 "2006-07-28T16:46:00Z")

</div>

Ola B. wrote:

> filters was most inspired. The only missing part is real prefix  
> notation  
> for it, but I guess I can manage without. =)

Ola, if I understand you correctly, you’re looking for standard RFC-2254  
filter syntax. Things like (for example):  
(&(objectclass=person)(mail=ola\*))

If that’s what you need, it’s there now. Look in the Rdoc for  
Net::LDAP::Filter#construct, which will accept a string like the above.  
The reason we didn’t support the standard filter syntax originally was  
because IMHO it sucks 🙂 and we wanted to give people a better  
alternative. The recommended way to do filters in Net::LDAP is with the  
original API, but we supported the standard filter-syntax because  
several people requested it.

---

<div class="post-metadata">

**Author:** ![gregarican](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/7feea3/32.png) [@gregarican](https://www.ruby-forum.com/u/gregarican)\
**Post date:** [July 28, 2006, 4:38pm UTC](https://www.ruby-forum.com/t/ruby-ldap-hooray/100357/6 "2006-07-28T16:38:59Z")

</div>

Francis C. wrote:

> Thanks. Let us know here if you hit any problems with the library or  
> if you have any feature requests. Sounds like you may be doing more  
> with Net::LDAP than just bind-authenticating users, so I’ll be curious  
> to follow your progress.

I’m also using it, and it’s really good. I’m actually specifically _not_  
doing authentication with LDAP in Ruby (centralized CAS server), but I  
am using LDAP as one of several data sources feeding a Rails  
application. I must say that your overloading of & and | for combining  
filters was most inspired. The only missing part is real prefix notation  
for it, but I guess I can manage without. =)

## Regards

Ola B. ([http://ola-bini.blogspot.com](http://ola-bini.blogspot.com))  
JvYAML, RbYAML, JRuby and Jatha contributor  
System Developer, Karolinska Institutet ([http://www.ki.se](http://www.ki.se))  
OLogix Consulting ([http://www.ologix.com](http://www.ologix.com))

“Yields falsehood when quined” yields falsehood when quined.

---

<div class="post-metadata">

**Author:** ![gregarican](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/7feea3/32.png) [@gregarican](https://www.ruby-forum.com/u/gregarican)\
**Post date:** [July 28, 2006, 4:55pm UTC](https://www.ruby-forum.com/t/ruby-ldap-hooray/100357/7 "2006-07-28T16:55:55Z")

</div>

Francis C. wrote:

> Net::LDAP::Filter#construct, which will accept a string like the above.  
> The reason we didn’t support the standard filter syntax originally was  
> because IMHO it sucks 🙂 and we wanted to give people a better  
> alternative. The recommended way to do filters in Net::LDAP is with the  
> original API, but we supported the standard filter-syntax because  
> several people requested it.

Haha, yes, I know it’s there, but not as language syntax. That was the  
neat part about the filter combinations, IMHO.

Regarding the standard LDAP filter syntax… well, I’m an avid Lisp  
lover, so, me likes it quite much. =) Each to his own. But your version  
is better from a Ruby perspective, of course.

–  
Ola B. ([http://ola-bini.blogspot.com](http://ola-bini.blogspot.com))  
JvYAML, RbYAML, JRuby and Jatha contributor  
System Developer, Karolinska Institutet ([http://www.ki.se](http://www.ki.se))  
OLogix Consulting ([http://www.ologix.com](http://www.ologix.com))

“Yields falsehood when quined” yields falsehood when quined.

---

<div class="post-metadata">

**Author:** ![gregarican](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/7feea3/32.png) [@gregarican](https://www.ruby-forum.com/u/gregarican)\
**Post date:** [July 28, 2006, 5:02pm UTC](https://www.ruby-forum.com/t/ruby-ldap-hooray/100357/8 "2006-07-28T17:02:49Z")

</div>

Ola B. wrote:

> Haha, yes, I know it’s there, but not as language syntax. That was  
> the  
> neat part about the filter combinations, IMHO.

Now I get it. So perhaps something like:

AND (filter-branch-1, filter-branch-2)

rather than:

filter-branch-1 & filter-branch-2

Correct?
