Getting to grips with ActiveLDAP

hi all,
I’m starting an application which uses OpenLDAP as the backend.

I’ve installed activeldap and its requirements, however i’m at a loss
for
how to get it to work.
From looking at various examples, I’ve put this code together:

  1 require 'rubygems'
  2 require_gem 'log4r'
  3 require_gem 'ruby-activeldap'
  4
  5 class User < ActiveLdap::Base
  6   ldap_mapping

:dn_attribute=>‘uid’,:prefix=>‘dc=office’,:classes=>[‘staffAccount’]
7 end
8 ActiveLdap::Base.establish_connection(
9 :host =>“192.168.1.27”,
10 :port =>389,
11 :bind_dn =>“cn=root,dc=office”,
12 :password=>“secret”)
13
14 user = User.find(“[email protected]*”)
15 puts user.displayName
16 user.displayName = “testing”
17 unless user.save
18 puts “failed”
19 puts user.errors.full_messages
20 exit 1
21 end

everything goes ok upto line 15 - it prints the displayName of that
record,
and i can print any other attributes. however, when i try to change
anything, i get this:
/usr/lib/ruby/gems/1.8/gems/ruby-activeldap-0.8.0/lib/active_ldap/adaptor/ldap.rb:288:in
operation': No such object (LDAP::NoSuchObject) from /usr/lib/ruby/gems/1.8/gems/ruby-activeldap-0.8.0/lib/active_ldap/timeout.rb:15:incall’
from
/usr/lib/ruby/gems/1.8/gems/ruby-activeldap-0.8.0/lib/active_ldap/timeout.rb:15:in
alarm' from /usr/lib/ruby/gems/1.8/gems/ruby-activeldap-0.8.0/lib/active_ldap/adaptor/base.rb:19:inwith_timeout’
from
/usr/lib/ruby/gems/1.8/gems/ruby-activeldap-0.8.0/lib/active_ldap/adaptor/ldap.rb:296:in
with_timeout' from /usr/lib/ruby/gems/1.8/gems/ruby-activeldap-0.8.0/lib/active_ldap/adaptor/ldap.rb:284:inoperation’
from
/usr/lib/ruby/gems/1.8/gems/ruby-activeldap-0.8.0/lib/active_ldap/adaptor/ldap.rb:269:in
modify' from /usr/lib/ruby/gems/1.8/gems/ruby-activeldap-0.8.0/lib/active_ldap/base.rb:392:inmodify’
from
/usr/lib/ruby/gems/1.8/gems/ruby-activeldap-0.8.0/lib/active_ldap/base.rb:1337:in
update_without_callbacks' from /usr/lib/ruby/gems/1.8/gems/ruby-activeldap-0.8.0/lib/active_ldap/base.rb:1298:inprepare_data_for_saving’
from
/usr/lib/ruby/gems/1.8/gems/ruby-activeldap-0.8.0/lib/active_ldap/base.rb:1333:in
update_without_callbacks' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/callbacks.rb:267:inupdate’
from
/usr/lib/ruby/gems/1.8/gems/ruby-activeldap-0.8.0/lib/active_ldap/base.rb:1279:in
create_or_update_without_callbacks' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/callbacks.rb:242:increate_or_update’
from
/usr/lib/ruby/gems/1.8/gems/ruby-activeldap-0.8.0/lib/active_ldap/base.rb:765:in
save_without_validation' from /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.1/lib/active_record/validations.rb:752:insave’

I’m not sure what “No such object” is refering to? any thoughts?

thanks,
Ol.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs