From enricob at gmail.com Tue Jul 7 14:39:44 2009 From: enricob at gmail.com (Enrico Bianco) Date: Tue, 7 Jul 2009 14:39:44 -0400 Subject: [activeldap-discuss] ActiveLDAP not co-operating with Webrat+Selenium Message-ID: Hi, I'm trying to set up automated acceptance testing with Cucumber, Webrat, and Selenium for a Rails project that is using ActiveLdap. My Cucumber steps include ActiveLdap calls that set up the appropriate context for pass-through authentication to LDAP by creating users. When I run my features without Selenium, they all pass, but when I run my tests with Selenium, I see strange errors like the following: invalid response-type in search: 9 (Net::LDAP::LdapError) ./features/step_definitions/enhanced/authentication_steps.rb: 8:in `/^a registered user "([^\"]*)" with username "([^\"]*)" and password "([^\"]*)"$/' features/plain/staff_authentication.feature:22:in `Given I am a registered user "Joe User" with username "juser" and password "test123"' response missing or invalid (Net::LDAP::LdapError) ./features/step_definitions/enhanced/authentication_steps.rb: 24:in `/^I am a logged in user$/' features/plain/staff_authentication.feature:17:in `Given I am a logged in user' They all happen during my LDAP setup steps. They seem to happen at random and happen less when I specify that Selenium should wait 2 or more seconds between steps. Is this some sort of concurrency issue? I've tried turning allow_concurrency on for all of the classes I use, including ActiveLdap::Base. Thank you, Enrico Bianco From kou at cozmixng.org Wed Jul 8 07:20:27 2009 From: kou at cozmixng.org (Kouhei Sutou) Date: Wed, 08 Jul 2009 20:20:27 +0900 (JST) Subject: [activeldap-discuss] ActiveLDAP not co-operating with Webrat+Selenium In-Reply-To: References: Message-ID: <20090708.202027.653026525707330291.kou@cozmixng.org> Hi, In "[activeldap-discuss] ActiveLDAP not co-operating with Webrat+Selenium" on Tue, 7 Jul 2009 14:39:44 -0400, Enrico Bianco wrote: > Is this some sort of concurrency issue? I've tried turning > allow_concurrency on for all of the classes I use, including > ActiveLdap::Base. Maybe yes. Net::LDAP isn't thread safe. Thanks, -- kou From kou at cozmixng.org Fri Jul 17 21:29:48 2009 From: kou at cozmixng.org (Kouhei Sutou) Date: Sat, 18 Jul 2009 10:29:48 +0900 Subject: [activeldap-discuss] [ANN] ActiveLdap 1.1.0 Message-ID: Hi, ActiveLdap 1.1.0 has been released! % sudo gem install activeldap Here are changes from 1.0.9: * Improved tutorial. [Kazuaki Takase] * Improvements: * API: * [#26] Supported to_xml for associations. [achemze] * ActiveLdap::Base.delete_all(filter=nil, options={}) -> ActiveLdap::Base.delete_all(filter_or_options={}). Sure, old method signature is also still supported. * belongs_to(:many) with :foreign_key is deprecated. Use :primary_key instead of :foreign_key. [Kazuaki Takase] * Means of has_many's :primary_key and :foreign_key are inverted. [Kazuaki Takase] * [experimental] Added ldap_field ActionView helper to generate form fileds for a LDAP entry. * Suppressed needless attributes updating. * Dependencies: * Re-supported GetText. * ActiveRecord 2.3.2 is only supported. Thanks, -- kou From alexey.chebotar at gmail.com Thu Jul 23 01:42:10 2009 From: alexey.chebotar at gmail.com (Alexey Chebotar) Date: Thu, 23 Jul 2009 08:42:10 +0300 Subject: [activeldap-discuss] Question about ActiveLdap::Base.delete_all Message-ID: <4A67F832.8030507@gmail.com> Hi! I have two models: org_unit.rb --- class OrgUnit < ActiveLdap::Base ldap_mapping :dn_attribute => "ou", :prefix => "", :classes => ['top', 'organizationalUnit'] end --- test_domain.rb --- class TestDomain < ActiveLdap::Base ldap_mapping :dn_attribute => "dc", :prefix => "", :classes => ['top', 'domain'] end --- Generating of tree: test_root = OrgUnit.create("test_root") test_child1 = OrgUnit.create(:ou => "test_child1", :parent => test_root) test_child2 = OrgUnit.create(:ou => "test_child2", :parent => test_root) test_child1_child1 = OrgUnit.create(:ou => "test_child1_child1", :parent => test_child1) test_root2 = OrgUnit.create("test_root2") test_domain1 = TestDomain.create(:dc => "test_domain1", :parent => test_child1) test_domain2 = TestDomain.create(:dc => "test_domain2", :parent => test_child2) Result: --- ou=test_root |-- ou=test_child1 | |-- dc=test_domain1 | |-- ou=test_child1_child1 |-- ou=test_child2 | |-- dc=test_domain2 ou=test_root2 --- Record without children can be deleted: >> test_root2.delete_all(filter_or_options={:base => test_root2.dn}) => ["ou=test_root2,dc=...,dc=com"] But I got error, when I tried delete record with children: >> test_root.delete_all(filter_or_options={:base => test_root.dn}) ActiveLdap::LdapError::NotAllowedOnNonleaf: Operation not allowed on non-leaf from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.1.0/lib/active_ldap/adapter/ldap_ext.rb:80:in `assert_error_code' from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.1.0/lib/active_ldap/adapter/ldap.rb:181:in `rescue in execute' from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.1.0/lib/active_ldap/adapter/ldap.rb:177:in `execute' from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.1.0/lib/active_ldap/adapter/ldap.rb:126:in `block in delete' from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.1.0/lib/active_ldap/adapter/base.rb:185:in `block (2 levels) in delete' from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.1.0/lib/active_ldap/adapter/base.rb:183:in `each' from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.1.0/lib/active_ldap/adapter/base.rb:183:in `block in delete' from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.1.0/lib/active_ldap/adapter/base.rb:266:in `block in operation' from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.1.0/lib/active_ldap/timeout.rb:15:in `call' from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.1.0/lib/active_ldap/timeout.rb:15:in `alarm' from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.1.0/lib/active_ldap/adapter/base.rb:312:in `with_timeout' from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.1.0/lib/active_ldap/adapter/base.rb:265:in `operation' from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.1.0/lib/active_ldap/adapter/base.rb:182:in `delete' from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.1.0/lib/active_ldap/adapter/ldap.rb:118:in `delete' from /usr/lib/ruby/gems/1.9.1/gems/activeldap-1.1.0/lib/active_ldap/operations.rb:516:in `delete_all' I can delete record with children via method ActiveLdap::Base.delete_all: >> ActiveLdap::Base.delete_all(filter_or_options={:base => test_root.dn}) => ["dc=test_domain1,ou=test_child1,ou=test_root,dc=...,dc=com", "ou=test_child1,ou=test_root,dc=...,dc=com", "ou=test_root,dc=...,dc=com"] But why I can't delete record with children via calling record.delete_all ? Could somebody explain what I doing wrong? --- openldap 2.4.16 (hdb database) ruby 1.9.1p0 (2009-01-30 revision 21907) [i686-linux] rubygems 1.3.4 ruby-ldap (0.9.9) activeldap (1.1.0) --- From kou at cozmixng.org Sat Jul 25 22:39:47 2009 From: kou at cozmixng.org (Kouhei Sutou) Date: Sun, 26 Jul 2009 11:39:47 +0900 (JST) Subject: [activeldap-discuss] Question about ActiveLdap::Base.delete_all In-Reply-To: <4A67F832.8030507@gmail.com> References: <4A67F832.8030507@gmail.com> Message-ID: <20090726.113947.600280415482049695.kou@cozmixng.org> Hi, Sorry for my late response. In <4A67F832.8030507 at gmail.com> "[activeldap-discuss] Question about ActiveLdap::Base.delete_all" on Thu, 23 Jul 2009 08:42:10 +0300, Alexey Chebotar wrote: > org_unit.rb > --- > class OrgUnit < ActiveLdap::Base > ldap_mapping :dn_attribute => "ou", :prefix => "", :classes > => ['top', 'organizationalUnit'] > end > --- > test_domain.rb > --- > class TestDomain < ActiveLdap::Base > ldap_mapping :dn_attribute => "dc", :prefix => "", :classes > => ['top', 'domain'] > end > --- > Result: > --- > ou=test_root > |-- ou=test_child1 > | |-- dc=test_domain1 > | |-- ou=test_child1_child1 > |-- ou=test_child2 > | |-- dc=test_domain2 > ou=test_root2 > --- > Record without children can be deleted: >>> test_root2.delete_all(filter_or_options={:base => >>> test_root2.dn}) > => ["ou=test_root2,dc=...,dc=com"] > But I got error, when I tried delete record with children: >>> test_root.delete_all(filter_or_options={:base => >>> test_root.dn}) > ActiveLdap::LdapError::NotAllowedOnNonleaf: Operation not > allowed on non-leaf > I can delete record with children via method > ActiveLdap::Base.delete_all: >>> ActiveLdap::Base.delete_all(filter_or_options={:base => >>> test_root.dn}) > => > ["dc=test_domain1,ou=test_child1,ou=test_root,dc=...,dc=com", > "ou=test_child1,ou=test_root,dc=...,dc=com", > "ou=test_root,dc=...,dc=com"] > > But why I can't delete record with children via calling > record.delete_all ? > Could somebody explain what I doing wrong? Because test_root can't find dc=test_domain1. (test_root and dc=test_domain1 has different objectClass.) If dc=test_domain1 isn't deleted, ou=test_child1 and ou=test_root can't be deleted. ActiveLdap::Base.search(:base => test_root.dn) can find all entries under test_root.dn. So ActiveLdap::Base.delete_all can delete all entries successfully. Suggested solution: Create Entry class and use it: class Entry < ActiveLdap::Base ldap_mapping :prefix => "", :classes => ["top"], :scope => :sub self.dn_attribute = nil end entry = Entry.find(test_root.dn) entry.delete_all # delete_all without argument can be work with trunk. # or Entry.delete_all(:base => test_root.dn) See also: examples/al-admin/app/model/entry.rb Thanks, -- kou From alexey.chebotar at gmail.com Thu Jul 30 04:38:37 2009 From: alexey.chebotar at gmail.com (Alexey Chebotar) Date: Thu, 30 Jul 2009 11:38:37 +0300 Subject: [activeldap-discuss] Question about ActiveLdap::Base.delete_all In-Reply-To: <20090726.113947.600280415482049695.kou@cozmixng.org> References: <4A67F832.8030507@gmail.com> <20090726.113947.600280415482049695.kou@cozmixng.org> Message-ID: <4A715C0D.40306@gmail.com> Kouhei Sutou ?????: > Because test_root can't find dc=test_domain1. (test_root and > dc=test_domain1 has different objectClass.) > > If dc=test_domain1 isn't deleted, ou=test_child1 and > ou=test_root can't be deleted. > > ActiveLdap::Base.search(:base => test_root.dn) can find all > entries under test_root.dn. So ActiveLdap::Base.delete_all > can delete all entries successfully. > > > Suggested solution: > > Create Entry class and use it: > > class Entry < ActiveLdap::Base > ldap_mapping :prefix => "", > :classes => ["top"], > :scope => :sub > self.dn_attribute = nil > end > > entry = Entry.find(test_root.dn) > entry.delete_all # delete_all without argument can be work with trunk. > # or > Entry.delete_all(:base => test_root.dn) > > > See also: examples/al-admin/app/model/entry.rb > Thanks for answer. Now I understand what I'm doing wrong :)