problem doing find in ActiveLdap

C

Claudio Claudio

require 'active_ldap'

ActiveLdap::Base.establish_connection(
:host => 'hostname',
:bind_dn => 'cn=admin,ou=users,dc=company,dc=it',
:base => 'ou=addressbooks,dc=company,dc=it',
:password_block => 'admin'
)

class Addressbook < ActiveLdap::Base
ldap_mapping :dn_attribute => 'cn', :prefix => 'ou=addressbooks'
end

p Addressbook.find:)all, 'John')
p Addressbook.find:)all, :attribute => 'givenName', :value => 'John')

both find returns []

What am I doing wrong?

thanks
 
K

Kouhei Sutou

Hi,

2007/7/19 said:
ActiveLdap::Base.establish_connection(
:host => 'hostname',
:bind_dn => 'cn=admin,ou=users,dc=company,dc=it',
:base => 'ou=addressbooks,dc=company,dc=it',
:password_block => 'admin'
)

You need to pass Proc object to :password_block or use :password
with String.
class Addressbook < ActiveLdap::Base
ldap_mapping :dn_attribute => 'cn', :prefix => 'ou=addressbooks'
end

In your configuration, you need to set :prefix to '' because you already
specify 'ou=addressbooks,dc=company,dc=it' as :base in
establish_connection. Or change :base to 'dc=company,dc=it' and keep
:prefix 'ou=addressbooks'.


Thanks,
 
C

Claudio Claudio

Kouhei said:
Hi,



You need to pass Proc object to :password_block or use :password
with String.


In your configuration, you need to set :prefix to '' because you already
specify 'ou=addressbooks,dc=company,dc=it' as :base in
establish_connection. Or change :base to 'dc=company,dc=it' and keep
:prefix 'ou=addressbooks'.


Thanks,

I follow your directive and i added this:

pwb = Proc.new do |user|
ActiveLdap::Command.read_password("[#{user}] Password: ")
end

...and works like a charm!!!!

Thanks a lot!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top