Forum: Ruby on Rails Ruby LDAP

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Stephane Fourdrinier - Fusemail (Guest)
on 2006-05-19 17:12
(Received via mailing list)
Anyone has done work with Ruby-Ldap? and maybe could provide some
examples? I have to admit that I am rather lost using this.

I am looking to do a Rails interface to manage LDAP servers but I can't
seem to find how to do this in Ruby and for example retrieve the
elements, attributes, and change them.

This is what I have done so far....

---
#!/appl/ruby/bin/ruby -w

require 'ldap'

conn = LDAP::Conn.new( 'ldapserver', 389 )
conn.set_option( LDAP::LDAP_OPT_PROTOCOL_VERSION, 3 )
res=conn.bind('cn=Manager,dc=domain,dc=com','password')

printf("connected %s",res)
conn.search('ou=people,dc=domain,dc=com',LDAP::LDAP_SCOPE_SUBTREE,'cn=*',['cn'])
do |entry|
        dn=entry.get_dn
        printf("dn: %s\n",dn)
       end

---

How could I get then the details of an entry, and modify them?

Any help would be greatly appreciated.
Stephane
Steven H. (Guest)
on 2006-05-19 17:15
(Received via mailing list)
I've been using the new Net::Ldap which has pretty good documentation.
The documentation is included with the source.

http://rubyforge.org/projects/net-ldap/
James H. (Guest)
on 2006-05-19 20:45
(Received via mailing list)
On 5/19/06, Stephane Fourdrinier - Fusemail 
<removed_email_address@domain.invalid>
wrote:
> Anyone has done work with Ruby-Ldap? and maybe could provide some
> examples? I have to admit that I am rather lost using this.
>
> I am looking to do a Rails interface to manage LDAP servers but I can't
> seem to find how to do this in Ruby and for example retrieve the
> elements, attributes, and change them.

You might look at ActiveLDAP, an ActiveRecord like layer on top of the
ruby ldap libs.

http://rubyforge.org/projects/ruby-activeldap/
http://wiki.rubyonrails.com/rails/pages/ActiveLDAP

cheers,
jh



--
James H.
Web application developer
Vancouver, BC

"Developing a coherent political analysis is in many respects
contingent upon an ability to connect one context to another, a
process not dissimilar to playing the kid's game of dot-to-dot."
 - Ward Churchill, from '"A Government of Laws"?'
Craig D. (Guest)
on 2006-05-20 18:38
(Received via mailing list)
Hi,

Have a look at Enterprise Integration with Ruby [http://
pragmaticprogrammer.com/titles/fr_eir/index.html]. It dedicates about
27 pages to the topic, and it discusses some of the libraries that
have been mentioned in other replies. One of the free excerpts is
even from the LDAP chapter!

Regards,
Craig
This topic is locked and can not be replied to.