From alexey.chebotar at gmail.com Mon Jun 1 04:28:12 2009 From: alexey.chebotar at gmail.com (Alexey Chebotar) Date: Mon, 01 Jun 2009 11:28:12 +0300 Subject: [activeldap-discuss] Question about children with different objectClass In-Reply-To: <20090531.235545.338122493853641384.kou@cozmixng.org> References: <4A1D5B1A.5000404@gmail.com> <20090531.235545.338122493853641384.kou@cozmixng.org> Message-ID: <4A23911C.7040005@gmail.com> Hi. Kouhei Sutou ?????: > It seems that AcitveLdap's default value isn't good. > > What about the code? > test_root.delete_all(nil, :base => nil) > This code does not work :( >> test_root.delete_all(nil, :base => nil) TypeError: can't convert nil into String from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/ldap.rb:179:in `search' from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/ldap.rb:179:in `block in execute' from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/base.rb:646:in `block in log' from /usr/lib/ruby/1.9.1/benchmark.rb:309:in `realtime' from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/base.rb:646:in `log' from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/ldap.rb:179:in `execute' from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/ldap.rb:90:in `block in search' from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/base.rb:165:in `block in search' from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/base.rb:266:in `block in operation' from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/timeout.rb:15:in `call' from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/timeout.rb:15:in `alarm' from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/base.rb:312:in `with_timeout' from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/base.rb:265:in `operation' from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/base.rb:164:in `search' from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/ldap.rb:83:in `search' from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/operations.rb:474:in `delete_all' from (irb):6 from /usr/bin/irb:12:in `
' > What about creating generic entry class? > > class Entry < ActiveLdap::Base > ldap_mapping :prefix => "", > :classes => ["top"], > :scope => :sub > end > > Entry.delete_all(:dn => test_child2.dn) > > This code also does not work >> test_child2 = OrgUnit.find "test_child2" >> Entry.delete_all(:dn => test_child2.dn) => nil >> test_child1 = OrgUnit.find "test_child1" >> Entry.delete_all(:dn => test_child1.dn) => nil > I'm sorry but I didn't try the above suggestions. > I don't have enough time for it.. Not a problem, I can wait :) I found another way for destroying entries in my case.. But soon I will have problem with modify_rdn :( I will have tree: --- ou=test_root |-- ou=test_child1 | |-- dc=test_domain1 | |-- ou=test_child1_child1 |-- ou=test_child2 | |-- dc=test_domain2 ou=test_root2 --- And I will need rename ou=test_child1 to ou=test_child3 >> test_child1.modify_rdn_entry(test_child1.dn, "dc=test_child3", true, {}) ActiveLdap::LdapError::NotAllowedOnNonleaf: Operation not allowed on non-leaf from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/ldap_ext.rb:80:in `assert_error_code' from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/ldap.rb:181:in `rescue in execute' from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/ldap.rb:177:in `execute' from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/ldap.rb:165:in `block in modify_rdn' from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/base.rb:234:in `block in modify_rdn' from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/base.rb:266:in `block in operation' from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/timeout.rb:15:in `call' from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/timeout.rb:15:in `alarm' from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/base.rb:312:in `with_timeout' from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/base.rb:265:in `operation' from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/base.rb:233:in `modify_rdn' from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/ldap.rb:160:in `modify_rdn' from /var/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/operations.rb:504:in `modify_rdn_entry' from (irb):25 from /usr/bin/irb:12:in `
' P.S. ActiveLdap revision is 963 From kou at cozmixng.org Mon Jun 1 09:49:29 2009 From: kou at cozmixng.org (Kouhei Sutou) Date: Mon, 01 Jun 2009 22:49:29 +0900 (JST) Subject: [activeldap-discuss] problems with rails 2.3.2 and active_ldap. In-Reply-To: References: <20090601.000024.507490017563662995.kou@cozmixng.org> Message-ID: <20090601.224929.1098872334715850914.kou@cozmixng.org> Hi, In "Re: [activeldap-discuss] problems with rails 2.3.2 and active_ldap." on Sun, 31 May 2009 21:07:07 +0200, Mauro wrote: >> You just need active_ldap gem. ActiveLdap plugin is included >> in the gem. > > Yes but....I have to use the plugin? > The plugin alone can be donwloaded and installed so there is no need of the gem. The plugin just provides ActiveLdap initialization on Rails application. The gem provides both of ActiveLdap itself and ActiveLdap initialization on Rails application. Thanks, -- kou From kou at cozmixng.org Mon Jun 1 10:10:14 2009 From: kou at cozmixng.org (Kouhei Sutou) Date: Mon, 01 Jun 2009 23:10:14 +0900 (JST) Subject: [activeldap-discuss] 1.0.9? Message-ID: <20090601.231014.1055929314494263631.kou@cozmixng.org> Hi Will, Could you release the current trunk as 1.0.9? We wanted to release 1.1.0 as the next release but we can't release in the near future. :< So it's better that we release 1.0.9 as 'Rails 2.3.2 support release' before 1.1.0. # I want to release 1.1.0 in RubyKaigi2009. :-) Thanks, -- kou From wad at gmail.com Mon Jun 1 10:29:14 2009 From: wad at gmail.com (Will Drewry) Date: Mon, 1 Jun 2009 09:29:14 -0500 Subject: [activeldap-discuss] 1.0.9? In-Reply-To: <20090601.231014.1055929314494263631.kou@cozmixng.org> References: <20090601.231014.1055929314494263631.kou@cozmixng.org> Message-ID: <2359eed20906010729y5c1c8036v732bb59acac8bf4f@mail.gmail.com> Hi kou, On Mon, Jun 1, 2009 at 9:10 AM, Kouhei Sutou wrote: > Hi Will, > > Could you release the current trunk as 1.0.9? Sure - I should get to it this evening (my time :). > We wanted to release 1.1.0 as the next release but we can't > release in the near future. :< > So it's better that we release 1.0.9 as 'Rails 2.3.2 support > release' before 1.1.0. Sounds perfect. > # I want to release 1.1.0 in RubyKaigi2009. :-) Awesome! From kou at cozmixng.org Mon Jun 1 10:41:00 2009 From: kou at cozmixng.org (Kouhei Sutou) Date: Mon, 01 Jun 2009 23:41:00 +0900 (JST) Subject: [activeldap-discuss] 1.0.9? In-Reply-To: <2359eed20906010729y5c1c8036v732bb59acac8bf4f@mail.gmail.com> References: <20090601.231014.1055929314494263631.kou@cozmixng.org> <2359eed20906010729y5c1c8036v732bb59acac8bf4f@mail.gmail.com> Message-ID: <20090601.234100.949267780715482931.kou@cozmixng.org> Hi, In <2359eed20906010729y5c1c8036v732bb59acac8bf4f at mail.gmail.com> "Re: 1.0.9?" on Mon, 1 Jun 2009 09:29:14 -0500, Will Drewry wrote: > On Mon, Jun 1, 2009 at 9:10 AM, Kouhei Sutou wrote: >> Hi Will, >> >> Could you release the current trunk as 1.0.9? > > Sure - I should get to it this evening (my time :). Thanks!!! >> We wanted to release 1.1.0 as the next release but we can't >> release in the near future. :< >> So it's better that we release 1.0.9 as 'Rails 2.3.2 support >> release' before 1.1.0. > > Sounds perfect. > >> # I want to release 1.1.0 in RubyKaigi2009. :-) > > Awesome! I hope that it will be true. ;-) -- kou From kou at cozmixng.org Mon Jun 1 11:21:29 2009 From: kou at cozmixng.org (Kouhei Sutou) Date: Tue, 02 Jun 2009 00:21:29 +0900 (JST) Subject: [activeldap-discuss] Question about children with different objectClass In-Reply-To: <4A23911C.7040005@gmail.com> References: <4A1D5B1A.5000404@gmail.com> <20090531.235545.338122493853641384.kou@cozmixng.org> <4A23911C.7040005@gmail.com> Message-ID: <20090602.002129.29649599483596.kou@cozmixng.org> Hi, I'm sorry for my wrong suggestions. In <4A23911C.7040005 at gmail.com> "Re: [activeldap-discuss] Question about children with different objectClass" on Mon, 01 Jun 2009 11:28:12 +0300, Alexey Chebotar wrote: >> It seems that AcitveLdap's default value isn't good. >> >> What about the code? >> test_root.delete_all(nil, :base => nil) >> > This code does not work :( > >>> test_root.delete_all(nil, :base => nil) > TypeError: can't convert nil into String What about this? OrgUnit.delete_all(nil, :base => test_root.dn) >> What about creating generic entry class? >> >> class Entry < ActiveLdap::Base >> ldap_mapping :prefix => "", >> :classes => ["top"], >> :scope => :sub >> end >> >> Entry.delete_all(:dn => test_child2.dn) >> >> > This code also does not work > >>> test_child2 = OrgUnit.find "test_child2" >>> Entry.delete_all(:dn => test_child2.dn) > => nil >>> test_child1 = OrgUnit.find "test_child1" >>> Entry.delete_all(:dn => test_child1.dn) > => nil Sorry. My code was too bad. :< class Entry < ActiveLdap::Base ldap_mapping :prefix => "", :classes => ["top"], :scope => :sub self.dn_attribute = nil end Entry.delete_all(nil, :base => test_child2.dn) > But soon I will have problem with modify_rdn :( > I will have tree: > --- > ou=test_root > |-- ou=test_child1 > | |-- dc=test_domain1 > | |-- ou=test_child1_child1 > |-- ou=test_child2 > | |-- dc=test_domain2 > ou=test_root2 > --- > And I will need rename ou=test_child1 to ou=test_child3 > >>> test_child1.modify_rdn_entry(test_child1.dn, >>> "dc=test_child3", true, {}) > ActiveLdap::LdapError::NotAllowedOnNonleaf: Operation not > allowed on non-leaf I'll look at this problem later. Sorry. Thanks, -- kou From alexey.chebotar at gmail.com Mon Jun 1 11:57:11 2009 From: alexey.chebotar at gmail.com (Alexey Chebotar) Date: Mon, 01 Jun 2009 18:57:11 +0300 Subject: [activeldap-discuss] Question about children with different objectClass In-Reply-To: <20090602.002129.29649599483596.kou@cozmixng.org> References: <4A1D5B1A.5000404@gmail.com> <20090531.235545.338122493853641384.kou@cozmixng.org> <4A23911C.7040005@gmail.com> <20090602.002129.29649599483596.kou@cozmixng.org> Message-ID: <4A23FA57.5070006@gmail.com> Kouhei Sutou ?????: > OrgUnit.delete_all(nil, :base => test_root.dn) > WOW! :) This code works for both cases: 1) ou=test_root |-- ou=test_child1 | |-- ou=test_child1_child1 |-- ou=test_child2 >> test_root = OrgUnit.find("test_root") >> test_root.delete_all(nil, :base => test_root.dn) => ["ou=test_child2,ou=test_root,dc=...,dc=com", "ou=test_child1_child1,ou=test_child1,ou=test_root,dc=...,dc=com", "ou=test_child1,ou=test_root,dc=...,dc=com", "ou=test_root,dc=...,dc=com"] 2) ou=test_root |-- ou=test_child1 | |-- dc=test_domain1 | |-- ou=test_child1_child1 |-- ou=test_child2 | |-- dc=test_domain2 test_root = OrgUnit.find("test_root") >> test_root.delete_all(nil, :base => test_root.dn) => ["dc=test_domain2,ou=test_child2,ou=test_root,dc=..,dc=com", "ou=test_child2,ou=test_root,dc=..,dc=com", "dc=test_domain1,ou=test_child1,ou=test_root,dc=..,dc=com", "ou=test_child1_child1,ou=test_child1,ou=test_root,dc=...,dc=com", "ou=test_child1,ou=test_root,dc=...,dc=com", "ou=test_root,dc=...,dc=com"] > Sorry. My code was too bad. :< > > class Entry < ActiveLdap::Base > ldap_mapping :prefix => "", > :classes => ["top"], > :scope => :sub > self.dn_attribute = nil > end > > Entry.delete_all(nil, :base => test_child2.dn) > This code works too :) Many thanks From kou at cozmixng.org Fri Jun 5 10:32:21 2009 From: kou at cozmixng.org (Kouhei Sutou) Date: Fri, 05 Jun 2009 23:32:21 +0900 (JST) Subject: [activeldap-discuss] 1.0.9? In-Reply-To: <2359eed20906031850t48f1dc0au35792e5588ce68a8@mail.gmail.com> References: <2359eed20906010729y5c1c8036v732bb59acac8bf4f@mail.gmail.com> <20090601.234100.949267780715482931.kou@cozmixng.org> <2359eed20906031850t48f1dc0au35792e5588ce68a8@mail.gmail.com> Message-ID: <20090605.233221.157559303663904724.kou@cozmixng.org> Hi, In <2359eed20906031850t48f1dc0au35792e5588ce68a8 at mail.gmail.com> "Re: 1.0.9?" on Wed, 3 Jun 2009 20:50:57 -0500, Will Drewry wrote: > Oops - I'm a little behind! I've attached the gem. If you think it > looks good, I'll post it and the tarball! I've already tagged svn for > 1.0.9. Thanks! It works for me. Please release 1.0.9! -- kou From wad at gmail.com Fri Jun 5 10:41:05 2009 From: wad at gmail.com (Will Drewry) Date: Fri, 5 Jun 2009 09:41:05 -0500 Subject: [activeldap-discuss] 1.0.9? In-Reply-To: <20090605.233221.157559303663904724.kou@cozmixng.org> References: <2359eed20906010729y5c1c8036v732bb59acac8bf4f@mail.gmail.com> <20090601.234100.949267780715482931.kou@cozmixng.org> <2359eed20906031850t48f1dc0au35792e5588ce68a8@mail.gmail.com> <20090605.233221.157559303663904724.kou@cozmixng.org> Message-ID: <2359eed20906050741k54ce794ct6b5f30e5211e3940@mail.gmail.com> On Fri, Jun 5, 2009 at 9:32 AM, Kouhei Sutou wrote: > Hi, > In <2359eed20906031850t48f1dc0au35792e5588ce68a8 at mail.gmail.com> > ?"Re: 1.0.9?" on Wed, 3 Jun 2009 20:50:57 -0500, > ?Will Drewry wrote: > >> Oops - I'm a little behind! ?I've attached the gem. ?If you think it >> looks good, I'll post it and the tarball! ?I've already tagged svn for >> 1.0.9. > > Thanks! > It works for me. > > Please release 1.0.9! Posted on rubyforge with an announcement. thanks! will From evaldo at gardenali.biz Fri Jun 5 07:32:36 2009 From: evaldo at gardenali.biz (Evaldo Gardenali) Date: Fri, 05 Jun 2009 08:32:36 -0300 Subject: [activeldap-discuss] one-to-many parent-children association Message-ID: <4A290254.5000904@gardenali.biz> Hi I need to model something like this: (different class names and purposes, but this is easier to understand, instead of a loooooong and boring story about objectClasses Foo and Bar) Base | |--Department (objectClass fooDepartment) | |-- User1 (objectClass fooUser) | |-- User2 |--Department2 |--User3 |--User4 I see something inside ActiveLdap::Association::Children, but I do not see how to use it, or how the child maps to the parent. Would someone please advise? Regards Evaldo Gardenali From kou at cozmixng.org Fri Jun 5 23:54:30 2009 From: kou at cozmixng.org (Kouhei Sutou) Date: Sat, 06 Jun 2009 12:54:30 +0900 (JST) Subject: [activeldap-discuss] [ANN] ActiveLdap 1.0.9 Message-ID: <20090606.125430.1033552815255190571.kou@cozmixng.org> Hi, ActiveLdap 1.0.9 had been released! http://ruby-activeldap.rubyforge.org/ % sudo gem install activeldap == Highlight Ruby 1.9.1 and Rails 2.3.2 are supported. == Changes 1.0.2 -> 1.0.9: * Added documents in Japanese. [Kazuaki Takase] * Supported Ruby 1.9.1. * [#20] [Ruby 1.9 Support] :: Running Tests [Alexey.Chebotar] * Supported Rails 2.3.2. * [#18] [Rails 2.3 Support] :: Running WEBrick Hangs [Alexey.Chebotar] * Bug fixes: * Fixed blank values detection. [David Morton] * [#22] Ruby 1.8.6 p287 :: Undefined methods [Alexey.Chebotar] * Fixed gem loading. [Tiago Fernandes] * Fixed DN change via #base=. [David Morton] * Fixed infinite retry on timeout. * Fixed needless reconnection. * API improvements: * Removed needless instance methods: #prefix=, #dn_attribute=, #sort_by=, #order=, #required_classes=, #recommended_classes= and #excluded_classes. [David Morton] * Removed obsolete scafoold_al generator. * Reduced default :retry_limit. * Supported association as parameter. [Joe Francis] * Normalized schema attribute name. [Tim Hermans] * Suppressed AuthenticationError -> ConnectionError conversion on reconnection. [Kazuaki Takase] * Added ActiveLdap::Schema#dump. * ActiveLdap::Base.establish_connection -> ActiveLdap::Base.setup_connection. * Supported ActiveLdap::Base.find(:last). * Added convenient methods: * ActiveLdap::Base.first * ActiveLdap::Base.last * ActiveLdap::Base.all == Thanks Thanks for all contributors: * Kazuaki Takase * Alexey.Chebotar * David Morton * Joe Francis Thanks, -- kou From kou at cozmixng.org Sat Jun 6 00:03:40 2009 From: kou at cozmixng.org (Kouhei Sutou) Date: Sat, 06 Jun 2009 13:03:40 +0900 (JST) Subject: [activeldap-discuss] one-to-many parent-children association In-Reply-To: <4A290254.5000904@gardenali.biz> References: <4A290254.5000904@gardenali.biz> Message-ID: <20090606.130340.803059383247740775.kou@cozmixng.org> Hi, In <4A290254.5000904 at gardenali.biz> "[activeldap-discuss] one-to-many parent-children association" on Fri, 05 Jun 2009 08:32:36 -0300, Evaldo Gardenali wrote: > I need to model something like this: (different class names > and purposes, but this is easier to understand, instead of a > loooooong and boring story about objectClasses Foo and Bar) > > Base > | > |--Department (objectClass fooDepartment) > | |-- User1 (objectClass fooUser) > | |-- User2 > |--Department2 > |--User3 > |--User4 > > I see something inside ActiveLdap::Association::Children, > but I do not see how to use it, or how the child maps to the > parent. I'm sorry but I can't understand what is your requirement. This? department1 = Department.find("department1") department1.users -> [#, #] In the above situation, you can define the following models: class Department < ActiveLdap::Base ldap_mapping :classes => ["fooDepartment"], ... def users User.find(:all, :base => dn, :connection => connection) end end class User < ActiveLdap::Base ldap_mapping :classes => ["fooUser"], ... end Thanks, -- kou From mrsanna1 at gmail.com Sun Jun 7 05:44:48 2009 From: mrsanna1 at gmail.com (Mauro) Date: Sun, 7 Jun 2009 11:44:48 +0200 Subject: [activeldap-discuss] rails 2.3.2 and activeldap. Message-ID: Sorry, but I don't still understand if I've to use activeldap gem or activeldap plugin. You said that the plugin just provides ActiveLdap initialization on Rails application. The gem provides both of ActiveLdap itself and ActiveLdap initialization on Rails application. Can you post some examples? With plugin I can initialize activeldap but also use it, so waht is the difference between gem and plugin? From kou at cozmixng.org Sun Jun 7 06:48:43 2009 From: kou at cozmixng.org (Kouhei Sutou) Date: Sun, 07 Jun 2009 19:48:43 +0900 (JST) Subject: [activeldap-discuss] rails 2.3.2 and activeldap. In-Reply-To: References: Message-ID: <20090607.194843.29593248145852421.kou@cozmixng.org> Hi, In "[activeldap-discuss] rails 2.3.2 and activeldap." on Sun, 7 Jun 2009 11:44:48 +0200, Mauro wrote: > Sorry, but I don't still understand if I've to use activeldap gem or > activeldap plugin. > You said that the plugin just provides ActiveLdap initialization on Rails > application. The gem provides both of ActiveLdap itself and > ActiveLdap initialization on Rails application. > Can you post some examples? > With plugin I can initialize activeldap but also use it, so waht is > the difference between gem and plugin? Sorry. I've misunderstood. You're right. Both of gem and plugin includes ActiveLdap itself and Rails adapter. Generally, please use the gem. It's stable rather than the plugin. The plugin is a snapshot of the latest ActiveLdap. Please use the plugin if the gem has a problem but the problem has been fixed in trunk. Now, the latest gem supports Rails 2.3.2. Please use the gem with Rails 2.3.2. Sorry for your confusion. Thanks, -- kou From mrsanna1 at gmail.com Sun Jun 7 07:34:07 2009 From: mrsanna1 at gmail.com (Mauro) Date: Sun, 7 Jun 2009 13:34:07 +0200 Subject: [activeldap-discuss] rails 2.3.2 and activeldap. In-Reply-To: <20090607.194843.29593248145852421.kou@cozmixng.org> References: <20090607.194843.29593248145852421.kou@cozmixng.org> Message-ID: 2009/6/7 Kouhei Sutou : > Hi, > > In > ?"[activeldap-discuss] rails 2.3.2 and activeldap." on Sun, 7 Jun 2009 11:44:48 +0200, > ?Mauro wrote: > >> Sorry, but I don't still understand if I've to use activeldap gem or >> activeldap plugin. >> You said that the plugin just provides ActiveLdap initialization on Rails >> application. The gem provides both of ActiveLdap itself and >> ActiveLdap initialization on Rails application. >> Can you post some examples? >> With plugin I can initialize activeldap but also use it, so waht is >> the difference between gem and plugin? > > Sorry. I've misunderstood. > You're right. Both of gem and plugin includes ActiveLdap > itself and Rails adapter. > > > Generally, please use the gem. It's stable rather than the > plugin. The plugin is a snapshot of the latest ActiveLdap. > > Please use the plugin if the gem has a problem but the > problem has been fixed in trunk. > > > Now, the latest gem supports Rails 2.3.2. Please use the gem > with Rails 2.3.2. Thank you for your answer. I've installed activeldap gem. Now I've to include it in my rails application with require 'active_ldap' and require 'net/ldap' in application_controller.rb? From kou at cozmixng.org Sun Jun 7 16:53:30 2009 From: kou at cozmixng.org (Kouhei Sutou) Date: Mon, 08 Jun 2009 05:53:30 +0900 (JST) Subject: [activeldap-discuss] rails 2.3.2 and activeldap. In-Reply-To: References: <20090607.194843.29593248145852421.kou@cozmixng.org> Message-ID: <20090608.055330.759900912627635917.kou@cozmixng.org> Hi, In "Re: [activeldap-discuss] rails 2.3.2 and activeldap." on Sun, 7 Jun 2009 13:34:07 +0200, Mauro wrote: > I've installed activeldap gem. > Now I've to include it in my rails application with require > 'active_ldap' and require 'net/ldap' in application_controller.rb? No. You should use config/environment.rb: config.gem "activeldap", :lib => "active_ldap" If you want to use Net::LDAP as LDAP backend, use config/ldap.rb: development: ... adapter: net-ldap Thanks, -- kou From mrsanna1 at gmail.com Mon Jun 8 04:16:04 2009 From: mrsanna1 at gmail.com (Mauro) Date: Mon, 8 Jun 2009 10:16:04 +0200 Subject: [activeldap-discuss] rails 2.3.2 and activeldap. In-Reply-To: <20090608.055330.759900912627635917.kou@cozmixng.org> References: <20090607.194843.29593248145852421.kou@cozmixng.org> <20090608.055330.759900912627635917.kou@cozmixng.org> Message-ID: 2009/6/7 Kouhei Sutou : > Hi, > > In > ?"Re: [activeldap-discuss] rails 2.3.2 and activeldap." on Sun, 7 Jun 2009 13:34:07 +0200, > ?Mauro wrote: > >> I've installed activeldap gem. >> Now I've to include it in my rails application with require >> 'active_ldap' and require 'net/ldap' in application_controller.rb? > > No. You should use config/environment.rb: > > ?config.gem "activeldap", :lib => "active_ldap" > > If you want to use Net::LDAP as LDAP backend, use > config/ldap.rb: > > ?development: > ? ?... > ? ?adapter: net-ldap I've done. I can connect to my LDAP backend without net-ldap, I'm only using activeldap as a gem. So there is no need to have net-ldap. From mrsanna1 at gmail.com Mon Jun 8 07:03:13 2009 From: mrsanna1 at gmail.com (Mauro) Date: Mon, 8 Jun 2009 13:03:13 +0200 Subject: [activeldap-discuss] user_link udefined method. Message-ID: I've done sudo gem installa activeldap, then config.gem "activeldap", :lib => "active_ldap" in environment.rb. Then script/generate scaffold_active_ldap, then script/generate model_active_ldap user and then script/generate controller user. In views/user/index.html.erb I've done: <% if @users.empty? %>

<%= "No user." %>

<% else %>
    <% @users.each do |user| %>
  • <%= user_link(user, true) %>
  • <% end %>
<% end %> Then I run the application but when I connect to http://localhost:3000/user it says: undefined method `user_link' for # Why user_link is undefined? From evaldo at gardenali.biz Tue Jun 9 09:55:51 2009 From: evaldo at gardenali.biz (Evaldo Gardenali) Date: Tue, 09 Jun 2009 10:55:51 -0300 Subject: [activeldap-discuss] one-to-many parent-children association In-Reply-To: <20090606.130340.803059383247740775.kou@cozmixng.org> References: <4A290254.5000904@gardenali.biz> <20090606.130340.803059383247740775.kou@cozmixng.org> Message-ID: <4A2E69E7.7060108@gardenali.biz> Kouhei Sutou wrote: > Hi, > > In <4A290254.5000904 at gardenali.biz> > "[activeldap-discuss] one-to-many parent-children association" on Fri, 05 Jun 2009 08:32:36 -0300, > Evaldo Gardenali wrote: > >> I need to model something like this: (different class names >> and purposes, but this is easier to understand, instead of a >> loooooong and boring story about objectClasses Foo and Bar) >> >> Base >> | >> |--Department (objectClass fooDepartment) >> | |-- User1 (objectClass fooUser) >> | |-- User2 >> |--Department2 >> |--User3 >> |--User4 >> >> I see something inside ActiveLdap::Association::Children, >> but I do not see how to use it, or how the child maps to the >> parent. >> > > I'm sorry but I can't understand what is your requirement. > > This? > department1 = Department.find("department1") > department1.users -> [#, #] > > In the above situation, you can define the following models: > > class Department < ActiveLdap::Base > ldap_mapping :classes => ["fooDepartment"], ... > > def users > User.find(:all, :base => dn, :connection => connection) > end > end > > class User < ActiveLdap::Base > ldap_mapping :classes => ["fooUser"], ... > end > > > Thanks, > -- > kou > Hi This is a 'loose'/'hacky' association method, as it seems. The way implemented in association/children.rb is way better structured, I just wanted the basics to use it effectively, as I cannot see a proper initializing function or parameter to it (has_many, belongs_to, that kind of stuff) This, although a hack, works quite well for showing things, but it doesnt work that nicely for nested model creation (a la 15-minute-blog-video "post.comments.create"). I wanted the proper way :) Regards Evaldo From mrsanna1 at gmail.com Tue Jun 9 17:16:31 2009 From: mrsanna1 at gmail.com (Mauro) Date: Tue, 9 Jun 2009 23:16:31 +0200 Subject: [activeldap-discuss] user_link undefined method. Message-ID: Sorry if I post again but I can't resolve a problem. I've installed activeldap gem, generate scaffold_active_ldap, generate model_active_ldap user and generate controller user. Create a method def index @users = User.find(:all) end and create a view index.html.erb: <% if @users.empty? -%>

<%= "No user." %>

<% else -%>
    <% @users.each do |user| -%>
  • <%= user_link(user, true) %>
  • <% end -%>
<% end -%> when I run localhost:3000/user if I have no user it display "No user." But if I have one or more users it says undefined method user_link. Why user_link is an undefined method? From tashen.hatena at gmail.com Tue Jun 9 20:47:00 2009 From: tashen.hatena at gmail.com (tashen) Date: Wed, 10 Jun 2009 09:47:00 +0900 Subject: [activeldap-discuss] one-to-many parent-children association In-Reply-To: <4A2E69E7.7060108@gardenali.biz> References: <4A290254.5000904@gardenali.biz> <20090606.130340.803059383247740775.kou@cozmixng.org> <4A2E69E7.7060108@gardenali.biz> Message-ID: <4A2F0284.3080105@gmail.com> Hi, I have no idea that for "proper way". But it might be make some hint for you, below. ---------------------------------------------------------------------- ActiveLdap::Base.setup_connection :host => 'localhost', :base => 'dc=com' class Department < ActiveLdap::Base ldap_mapping :dn_attribute => 'ou', :prefix => 'dc=example', :classes => 'organizationalUnit', :scope => :one def users unless @users_class attr_name = dn_attribute attr_value = self.send attr_name parent_obj = self @user_class = Class.new(ActiveLdap::Base) do ldap_mapping :prefix => "#{attr_name}=#{attr_value},dc=example", :dn_attribute => 'cn', :classes => 'person' @@parent_obj = parent_obj def parent @@parent_obj end end end @user_class end end ---------------------------------------------------------------------- you can: ---------------------------------------------------------------------- irb> d = Department.find 'Department' => #, ...> irb> u = d.users.find :first => #<# objectClass:,...> irb> u.parent => #, ...> ---------------------------------------------------------------------- LDIF used to test: ---------------------------------------------------------------------- dn: ou=Department,dc=example,dc=com objectClass: organizationalUnit ou: Department dn: ou=Department2,dc=example,dc=com objectClass: organizationalUnit ou: Department2 dn: cn=hoge,ou=Department,dc=example,dc=com sn: hoge cn: hoge objectClass: person objectClass: top dn: cn=fuga,ou=Department2,dc=example,dc=com sn: fuga cn: fuga objectClass: person objectClass: top ---------------------------------------------------------------------- Evaldo Gardenali wrote: > Kouhei Sutou wrote: >> Hi, >> >> In <4A290254.5000904 at gardenali.biz> >> "[activeldap-discuss] one-to-many parent-children association" on >> Fri, 05 Jun 2009 08:32:36 -0300, >> Evaldo Gardenali wrote: >> >>> I need to model something like this: (different class names >>> and purposes, but this is easier to understand, instead of a >>> loooooong and boring story about objectClasses Foo and Bar) >>> >>> Base >>> | >>> |--Department (objectClass fooDepartment) >>> | |-- User1 (objectClass fooUser) >>> | |-- User2 >>> |--Department2 >>> |--User3 >>> |--User4 >>> >>> I see something inside ActiveLdap::Association::Children, >>> but I do not see how to use it, or how the child maps to the >>> parent. >>> >> >> I'm sorry but I can't understand what is your requirement. >> >> This? >> department1 = Department.find("department1") >> department1.users -> [#, #] >> >> In the above situation, you can define the following models: >> >> class Department < ActiveLdap::Base >> ldap_mapping :classes => ["fooDepartment"], ... >> >> def users >> User.find(:all, :base => dn, :connection => connection) >> end >> end >> >> class User < ActiveLdap::Base >> ldap_mapping :classes => ["fooUser"], ... >> end >> >> >> Thanks, >> -- >> kou >> > > Hi > > This is a 'loose'/'hacky' association method, as it seems. The way > implemented in association/children.rb is way better structured, I just > wanted the basics to use it effectively, as I cannot see a proper > initializing function or parameter to it (has_many, belongs_to, that > kind of stuff) > > This, although a hack, works quite well for showing things, but it > doesnt work that nicely for nested model creation (a la > 15-minute-blog-video "post.comments.create"). I wanted the proper way :) > > Regards > > Evaldo > > _______________________________________________ > ruby-activeldap-discuss mailing list > ruby-activeldap-discuss at rubyforge.org > http://rubyforge.org/mailman/listinfo/ruby-activeldap-discuss -- tashen (Kazuaki Takase) http://d.hatena.ne.jp/tashen From alexey.chebotar at gmail.com Wed Jun 10 08:59:33 2009 From: alexey.chebotar at gmail.com (Alexey Chebotar) Date: Wed, 10 Jun 2009 15:59:33 +0300 Subject: [activeldap-discuss] Question about children with different objectClass In-Reply-To: <20090602.002129.29649599483596.kou@cozmixng.org> References: <4A1D5B1A.5000404@gmail.com> <20090531.235545.338122493853641384.kou@cozmixng.org> <4A23911C.7040005@gmail.com> <20090602.002129.29649599483596.kou@cozmixng.org> Message-ID: <4A2FAE35.7080801@gmail.com> Kouhei Sutou ?????: >> But soon I will have problem with modify_rdn :( >> I will have tree: >> --- >> ou=test_root >> |-- ou=test_child1 >> | |-- dc=test_domain1 >> | |-- ou=test_child1_child1 >> |-- ou=test_child2 >> | |-- dc=test_domain2 >> ou=test_root2 >> --- >> And I will need rename ou=test_child1 to ou=test_child3 >> >> >>>> test_child1.modify_rdn_entry(test_child1.dn, >>>> "dc=test_child3", true, {}) >>>> >> ActiveLdap::LdapError::NotAllowedOnNonleaf: Operation not >> allowed on non-leaf >> > > I'll look at this problem later. Sorry. > Sorry, I was wrong, here must be: ou=test_child3, not dc=test_child3 >> test_child1.modify_rdn_entry(test_child1.dn, "ou=test_child3", true, {}) ActiveLdap::LdapError::NotAllowedOnNonleaf: Operation not allowed on non-leaf from /var/iVOCS/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/ldap_ext.rb:80:in `assert_error_code' from /var/iVOCS/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/ldap.rb:181:in `rescue in execute' from /var/iVOCS/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/ldap.rb:177:in `execute' from /var/iVOCS/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/ldap.rb:165:in `block in modify_rdn' from /var/iVOCS/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/base.rb:234:in `block in modify_rdn' from /var/iVOCS/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/base.rb:266:in `block in operation' from /var/iVOCS/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/timeout.rb:15:in `call' from /var/iVOCS/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/timeout.rb:15:in `alarm' from /var/iVOCS/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/base.rb:312:in `with_timeout' from /var/iVOCS/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/base.rb:265:in `operation' from /var/iVOCS/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/base.rb:233:in `modify_rdn' from /var/iVOCS/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/ldap.rb:160:in `modify_rdn' from /var/iVOCS/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/operations.rb:504:in `modify_rdn_entry' from (irb):11 from /usr/bin/irb:12:in `
' But this problem (with modify_rdn_entry) solved by changing DB type from bdb to hdb :) "database hdb" in slapd.conf ?> test_child1 = OrgUnit.find "test_child1" => # >> test_child1.modify_rdn_entry(test_child1.dn, "ou=test_child3", true, {}) => # Thanks to Sergey Yanovitsky for help Can I, somehow, get children from parent, with different objectClass than parent? Or parent from entry with different objectClass? >> test_child1 = OrgUnit.find "test_child1" => #, must:, may:<...>, ..., ou: ["test_child1"], ...> >> test_child1.children => #, must:, may:<...>, ..., ou: ["test_child1"], ...>, @options={}, @target=[], @loaded=false> >> test_child1.children.reload => [#, must:, may:<...>, ..., ou: ["test_child1_child1"], ...>] >> test_child1.children.target => [#, must:, may:<...>, ..., ou: ["test_child1_child1"], ....>] >> test_domain1 = TestDomain.find "test_domain1" => #, must:, may:<...>, ..., dc: ["test_domain1"], ...> >> test_domain1.parent => nil From alexey.chebotar at gmail.com Wed Jun 10 08:59:33 2009 From: alexey.chebotar at gmail.com (Alexey Chebotar) Date: Wed, 10 Jun 2009 15:59:33 +0300 Subject: [activeldap-discuss] Question about children with different objectClass In-Reply-To: <20090602.002129.29649599483596.kou@cozmixng.org> References: <4A1D5B1A.5000404@gmail.com> <20090531.235545.338122493853641384.kou@cozmixng.org> <4A23911C.7040005@gmail.com> <20090602.002129.29649599483596.kou@cozmixng.org> Message-ID: <4A2FAE35.7080801@gmail.com> Kouhei Sutou ?????: >> But soon I will have problem with modify_rdn :( >> I will have tree: >> --- >> ou=test_root >> |-- ou=test_child1 >> | |-- dc=test_domain1 >> | |-- ou=test_child1_child1 >> |-- ou=test_child2 >> | |-- dc=test_domain2 >> ou=test_root2 >> --- >> And I will need rename ou=test_child1 to ou=test_child3 >> >> >>>> test_child1.modify_rdn_entry(test_child1.dn, >>>> "dc=test_child3", true, {}) >>>> >> ActiveLdap::LdapError::NotAllowedOnNonleaf: Operation not >> allowed on non-leaf >> > > I'll look at this problem later. Sorry. > Sorry, I was wrong, here must be: ou=test_child3, not dc=test_child3 >> test_child1.modify_rdn_entry(test_child1.dn, "ou=test_child3", true, {}) ActiveLdap::LdapError::NotAllowedOnNonleaf: Operation not allowed on non-leaf from /var/iVOCS/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/ldap_ext.rb:80:in `assert_error_code' from /var/iVOCS/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/ldap.rb:181:in `rescue in execute' from /var/iVOCS/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/ldap.rb:177:in `execute' from /var/iVOCS/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/ldap.rb:165:in `block in modify_rdn' from /var/iVOCS/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/base.rb:234:in `block in modify_rdn' from /var/iVOCS/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/base.rb:266:in `block in operation' from /var/iVOCS/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/timeout.rb:15:in `call' from /var/iVOCS/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/timeout.rb:15:in `alarm' from /var/iVOCS/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/base.rb:312:in `with_timeout' from /var/iVOCS/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/base.rb:265:in `operation' from /var/iVOCS/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/base.rb:233:in `modify_rdn' from /var/iVOCS/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/adapter/ldap.rb:160:in `modify_rdn' from /var/iVOCS/onm/vendor/plugins/activeldap-trunk/lib/active_ldap/operations.rb:504:in `modify_rdn_entry' from (irb):11 from /usr/bin/irb:12:in `
' But this problem (with modify_rdn_entry) solved by changing DB type from bdb to hdb :) "database hdb" in slapd.conf ?> test_child1 = OrgUnit.find "test_child1" => # >> test_child1.modify_rdn_entry(test_child1.dn, "ou=test_child3", true, {}) => # Thanks to Sergey Yanovitsky for help Can I, somehow, get children from parent, with different objectClass than parent? Or parent from entry with different objectClass? >> test_child1 = OrgUnit.find "test_child1" => #, must:, may:<...>, ..., ou: ["test_child1"], ...> >> test_child1.children => #, must:, may:<...>, ..., ou: ["test_child1"], ...>, @options={}, @target=[], @loaded=false> >> test_child1.children.reload => [#, must:, may:<...>, ..., ou: ["test_child1_child1"], ...>] >> test_child1.children.target => [#, must:, may:<...>, ..., ou: ["test_child1_child1"], ....>] >> test_domain1 = TestDomain.find "test_domain1" => #, must:, may:<...>, ..., dc: ["test_domain1"], ...> >> test_domain1.parent => nil From kou at cozmixng.org Wed Jun 10 07:17:24 2009 From: kou at cozmixng.org (Kouhei Sutou) Date: Wed, 10 Jun 2009 20:17:24 +0900 (JST) Subject: [activeldap-discuss] user_link udefined method. In-Reply-To: References: Message-ID: <20090610.201724.655406241861191205.kou@cozmixng.org> Hi, In "[activeldap-discuss] user_link udefined method." on Mon, 8 Jun 2009 13:03:13 +0200, Mauro wrote: > I've done sudo gem installa activeldap, then config.gem "activeldap", > :lib => "active_ldap" in environment.rb. > Then script/generate scaffold_active_ldap, then script/generate > model_active_ldap user and then script/generate controller user. > In views/user/index.html.erb I've done: > <% if @users.empty? %> >

> <%= "No user." %> >

> <% else %> >
    > <% @users.each do |user| %> >
  • > <%= user_link(user, true) %> >
  • > <% end %> >
> <% end %> > > Then I run the application but when I connect to > http://localhost:3000/user it says: > > undefined method `user_link' for # > > Why user_link is undefined? What is 'user_link'? What about this? link_to("label", user) Thanks, -- kou From kou at cozmixng.org Wed Jun 10 07:23:21 2009 From: kou at cozmixng.org (Kouhei Sutou) Date: Wed, 10 Jun 2009 20:23:21 +0900 (JST) Subject: [activeldap-discuss] Ruby/LDAP 0.9.9? Message-ID: <20090610.202321.1089447038122133112.kou@cozmixng.org> Hi, Is there a plan to Ruby/LDAP 0.9.9? My friend wants to use Ruby/LDAP with OpenLDAP 2.4. But Ruby/LDAP 0.9.8 can't build with OpenLDAP 2.4. P.S. Is there a plan to release gem on rubyforge.net? If Ruby/LDAP gem is released on rubyforge.net, we can install Ruby/LDAP easily with 'sudo gem install ruby-ldap'. :) Thanks, -- kou From mrsanna1 at gmail.com Wed Jun 10 15:25:01 2009 From: mrsanna1 at gmail.com (Mauro) Date: Wed, 10 Jun 2009 21:25:01 +0200 Subject: [activeldap-discuss] user_link udefined method. In-Reply-To: <20090610.201724.655406241861191205.kou@cozmixng.org> References: <20090610.201724.655406241861191205.kou@cozmixng.org> Message-ID: 2009/6/10 Kouhei Sutou : > Hi, > > In > ?"[activeldap-discuss] user_link udefined method." on Mon, 8 Jun 2009 13:03:13 +0200, > ?Mauro wrote: > >> I've done sudo gem installa activeldap, then config.gem "activeldap", >> :lib => "active_ldap" in environment.rb. >> Then script/generate scaffold_active_ldap, then script/generate >> model_active_ldap user and then script/generate controller user. >> In views/user/index.html.erb I've done: >> ?<% if @users.empty? %> >>

>> ? <%= "No user." %> >>

>> <% else %> >>
    >> ? <% @users.each do |user| %> >> ?
  • >> ? ? <%= user_link(user, true) ?%> >> ?
  • >> ? <% end %> >>
>> <% end %> >> >> Then I run the application but when I connect to >> http://localhost:3000/user it says: >> >> undefined method `user_link' for # >> >> Why user_link is undefined? > > What is 'user_link'? > > What about this? > ?link_to("label", user) I''ve installed activeldap gem. Under gems/activeldap/example/al-admin/app/views/users there is index.html.erb. In this file there is: <% if @users.empty? -%>

<%= _("No user.") %>

<% else -%>

<%=h LdapUser.base %>

    <% @users.each do |user| -%>
  • <%= user_link(user, true) %>
  • <% end -%>
<% end -%> So the method is user_link. Is it an error of the example? From MR-Mencel at wiu.edu Thu Jun 11 01:26:02 2009 From: MR-Mencel at wiu.edu (Matt Mencel) Date: Thu, 11 Jun 2009 00:26:02 -0500 (CDT) Subject: [activeldap-discuss] Closing the ActiveLdap Connection In-Reply-To: Message-ID: <1506525150.1544471244697962017.JavaMail.root@zcs10> Used to be that ActiveLdap::Base.close worked....didn't it? That method doesn't work anymore (I'm running 1.0.9)....so how do you close the existing ActiveLdap connection? Here is my sample code....and I've commented out the close for now. class User < ActiveLdap::Base ldap_mapping :dn_attribute => "uid", :prefix => "ou=people" def empty?() self.have_attribute?("dn") end def self.authenticate(username, password) return false if username.empty? or password.empty? begin ActiveLdap::Base.setup_connection( :host => "ldap.wiu.edu", :port => 389, :base => "dc=wiu,dc=edu", :bind_dn => "uid=#{username},ou=People,dc=wiu,dc=edu", :password_block => Proc.new { password }, :allow_anonymous => false ) #ActiveLdap::Base.close return true rescue ActiveLdap::AuthenticationError return false end end end Thanks, Matt From alexey.chebotar at gmail.com Thu Jun 11 04:23:07 2009 From: alexey.chebotar at gmail.com (Alexey Chebotar) Date: Thu, 11 Jun 2009 11:23:07 +0300 Subject: [activeldap-discuss] Ruby/LDAP 0.9.9? In-Reply-To: <20090610.202321.1089447038122133112.kou@cozmixng.org> References: <20090610.202321.1089447038122133112.kou@cozmixng.org> Message-ID: <458a4ba50906110123j557b8c14u73512a357cf004e7@mail.gmail.com> Hi kou. I has attached gem, he includes ruby-ldap version 0.9.9. Can you please test this gem with your friend on OpenLDAP 2.4.15 or higher? :) I will announce about ruby-ldap 0.9.9 if gem will work Is there a plan to Ruby/LDAP 0.9.9? > > My friend wants to use Ruby/LDAP with OpenLDAP 2.4. But > Ruby/LDAP 0.9.8 can't build with OpenLDAP 2.4. > > P.S. Is there a plan to release gem on rubyforge.net? If > Ruby/LDAP gem is released on rubyforge.net, we can install > Ruby/LDAP easily with 'sudo gem install ruby-ldap'. :) > Just do 'sudo gem install ruby-ldap-0.9.9.gem' ;-) P.S.: Gem works for me :) And I has registered project on Rubyforge http://rubyforge.org/projects/ruby-ldap/ -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ruby-ldap-0.9.9.gem Type: application/octet-stream Size: 54272 bytes Desc: not available URL: From kou at cozmixng.org Thu Jun 11 08:52:36 2009 From: kou at cozmixng.org (Kouhei Sutou) Date: Thu, 11 Jun 2009 21:52:36 +0900 (JST) Subject: [activeldap-discuss] Ruby/LDAP 0.9.9? In-Reply-To: <458a4ba50906110123j557b8c14u73512a357cf004e7@mail.gmail.com> References: <20090610.202321.1089447038122133112.kou@cozmixng.org> <458a4ba50906110123j557b8c14u73512a357cf004e7@mail.gmail.com> Message-ID: <20090611.215236.934659361650074140.kou@cozmixng.org> Hi, In <458a4ba50906110123j557b8c14u73512a357cf004e7 at mail.gmail.com> "Re: [activeldap-discuss] Ruby/LDAP 0.9.9?" on Thu, 11 Jun 2009 11:23:07 +0300, Alexey Chebotar wrote: > I has attached gem, he includes ruby-ldap version 0.9.9. Great! > Can you please test this gem with your friend on OpenLDAP 2.4.15 or higher? :) It works with OpenLDAP 2.4.15 on my environment. But I find a bug that LDAP::VERSION is still 0.9.7. ;-) > I will announce about ruby-ldap 0.9.9 if gem will work Could you also release .tar.gz? My friend doesn't use gem... > P.S.: Gem works for me :) And I has registered project on Rubyforge http:// > rubyforge.org/projects/ruby-ldap/ It's good news. :) P.S.: My friend said 'Thanks Alexey for releasing 0.9.9!'. :) Thanks, -- kou From kou at cozmixng.org Thu Jun 11 08:54:44 2009 From: kou at cozmixng.org (Kouhei Sutou) Date: Thu, 11 Jun 2009 21:54:44 +0900 (JST) Subject: [activeldap-discuss] user_link udefined method. In-Reply-To: References: <20090610.201724.655406241861191205.kou@cozmixng.org> Message-ID: <20090611.215444.1042906170178798084.kou@cozmixng.org> Hi, In "Re: [activeldap-discuss] user_link udefined method." on Wed, 10 Jun 2009 21:25:01 +0200, Mauro wrote: >>> I've done sudo gem installa activeldap, then config.gem "activeldap", >>> :lib => "active_ldap" in environment.rb. >>> Then script/generate scaffold_active_ldap, then script/generate >>> model_active_ldap user and then script/generate controller user. >>> In views/user/index.html.erb I've done: >>> ?<% if @users.empty? %> >>>

>>> ? <%= "No user." %> >>>

>>> <% else %> >>>
    >>> ? <% @users.each do |user| %> >>> ?
  • >>> ? ? <%= user_link(user, true) ?%> >>> ?
  • >>> ? <% end %> >>>
>>> <% end %> >>> >>> Then I run the application but when I connect to >>> http://localhost:3000/user it says: >>> >>> undefined method `user_link' for # >>> >>> Why user_link is undefined? >> >> What is 'user_link'? >> >> What about this? >> ?link_to("label", user) > > I''ve installed activeldap gem. > Under gems/activeldap/example/al-admin/app/views/users there is index.html.erb. > In this file there is: > > <% if @users.empty? -%> >

<%= _("No user.") %>

> <% else -%> >

<%=h LdapUser.base %>

>
    > <% @users.each do |user| -%> >
  • <%= user_link(user, true) %>
  • > <% end -%> >
> <% end -%> > > So the method is user_link. > Is it an error of the example? Ah, I see. user_link is defined in the example. See app/helpers/users_helper.rb. Thanks, -- kou From kou at cozmixng.org Thu Jun 11 09:04:40 2009 From: kou at cozmixng.org (Kouhei Sutou) Date: Thu, 11 Jun 2009 22:04:40 +0900 (JST) Subject: [activeldap-discuss] Closing the ActiveLdap Connection In-Reply-To: <1506525150.1544471244697962017.JavaMail.root@zcs10> References: <1506525150.1544471244697962017.JavaMail.root@zcs10> Message-ID: <20090611.220440.418046536507914508.kou@cozmixng.org> Hi, In <1506525150.1544471244697962017.JavaMail.root at zcs10> "[activeldap-discuss] Closing the ActiveLdap Connection" on Thu, 11 Jun 2009 00:26:02 -0500 (CDT), Matt Mencel wrote: > Used to be that ActiveLdap::Base.close worked....didn't it? That method doesn't work anymore (I'm running 1.0.9)....so how do you close the existing ActiveLdap connection? Here is my sample code....and I've commented out the close for now. It's ActiveLdap::Base.connection.disconnect! But you should use ActiveLdap::Base#bind and ActiveLdap::Base#remove_connection. > class User < ActiveLdap::Base > ldap_mapping :dn_attribute => "uid", > :prefix => "ou=people" > > def empty?() > self.have_attribute?("dn") > end > > def self.authenticate(username, password) > return false if username.empty? or password.empty? find(username).authenticated?(password) end def authenticated?(password) bind(password) remove_connection true rescue ActiveLdap::AuthenticationError, ActiveLdap::LdapError::UnwillingToPerform false end > end See also: http://code.google.com/p/ruby-activeldap/source/browse/trunk/examples/al-admin/app/models/ldap_user.rb Thanks, -- kou From MR-Mencel at wiu.edu Thu Jun 11 12:02:24 2009 From: MR-Mencel at wiu.edu (Matt Mencel) Date: Thu, 11 Jun 2009 11:02:24 -0500 (CDT) Subject: [activeldap-discuss] Closing the ActiveLdap Connection In-Reply-To: <346354318.1612661244736050932.JavaMail.root@zcs10> Message-ID: <1262230884.1613161244736144513.JavaMail.root@zcs10> Awesome! That is much cleaner. Thanks! I've documented the work I've done the last couple days to get LDAP browsing and authentication working in a sample Rails app. A bunch of the info I found already out there was getting pretty dated. Anyway, it's up on my blog page if you or anyone else is interested in critiquing it. :) http://www.techminer.net/blog/?p=60 Thanks, Matt ----- Original Message ----- From: "Kouhei Sutou" To: ruby-activeldap-discuss at rubyforge.org Sent: Thursday, June 11, 2009 8:04:40 AM GMT -06:00 US/Canada Central Subject: Re: [activeldap-discuss] Closing the ActiveLdap Connection Hi, In <1506525150.1544471244697962017.JavaMail.root at zcs10> "[activeldap-discuss] Closing the ActiveLdap Connection" on Thu, 11 Jun 2009 00:26:02 -0500 (CDT), Matt Mencel wrote: > Used to be that ActiveLdap::Base.close worked....didn't it? That method doesn't work anymore (I'm running 1.0.9)....so how do you close the existing ActiveLdap connection? Here is my sample code....and I've commented out the close for now. It's ActiveLdap::Base.connection.disconnect! But you should use ActiveLdap::Base#bind and ActiveLdap::Base#remove_connection. > class User < ActiveLdap::Base > ldap_mapping :dn_attribute => "uid", > :prefix => "ou=people" > > def empty?() > self.have_attribute?("dn") > end > > def self.authenticate(username, password) > return false if username.empty? or password.empty? find(username).authenticated?(password) end def authenticated?(password) bind(password) remove_connection true rescue ActiveLdap::AuthenticationError, ActiveLdap::LdapError::UnwillingToPerform false end > end See also: http://code.google.com/p/ruby-activeldap/source/browse/trunk/examples/al-admin/app/models/ldap_user.rb Thanks, -- kou _______________________________________________ ruby-activeldap-discuss mailing list ruby-activeldap-discuss at rubyforge.org http://rubyforge.org/mailman/listinfo/ruby-activeldap-discuss From alexey.chebotar at gmail.com Thu Jun 11 12:05:08 2009 From: alexey.chebotar at gmail.com (Alexey Chebotar) Date: Thu, 11 Jun 2009 19:05:08 +0300 Subject: [activeldap-discuss] [ANN] Ruby/LDAP 0.9.9 Message-ID: <458a4ba50906110905p38e35fa4mb585fb93d73f0874@mail.gmail.com> Hi, Ruby/LDAP 0.9.9 had been released! I think, Rubyforge is better than Sourceforge for storing Ruby extensions, because of this, I want say to all: >From this moment primary site of project is Rubyforge * http://ruby-ldap.rubyforge.org/ (Will be updated soon) * http://rubyforge.org/projects/ruby-ldap/ * Mirror for Download: ruby-activeldap project on Googlecode - http://code.google.com/p/ruby-activeldap/downloads/list With this release (and in future), you can use ruby-ldap as an ruby gem: % sudo gem install ruby-ldap Also, added support of OpenLDAP 2.4.15 and higher. == Changes 0.9.8 -> 0.9.9: * Fixed LDAP::VERSION. Thanks to Kouhei Sutou * Gem Packaging Support. Thanks to S. Potter [mbbx6spp] * LDAP_OPT_X_TLS_PROTOCOL changed to LDAP_OPT_X_TLS_PROTOCOL_MIN (more information in ITS#5655). Thanks to Milos Jakubicek * Fixed regular expression in LDAP::Schema.attr() P.S.: I will investigate all reports in Sourceforge project page P.S.S.: Kou, please let me know if you want remove files from your project -------------- next part -------------- An HTML attachment was scrubbed... URL: From kou at cozmixng.org Mon Jun 22 11:02:36 2009 From: kou at cozmixng.org (Kouhei Sutou) Date: Tue, 23 Jun 2009 00:02:36 +0900 (JST) Subject: [activeldap-discuss] Question about children with different objectClass In-Reply-To: <4A2FAE35.7080801@gmail.com> References: <4A23911C.7040005@gmail.com> <20090602.002129.29649599483596.kou@cozmixng.org> <4A2FAE35.7080801@gmail.com> Message-ID: <20090623.000236.840493247503766685.kou@cozmixng.org> Hi, In <4A2FAE35.7080801 at gmail.com> "Re: [activeldap-discuss] Question about children with different objectClass" on Wed, 10 Jun 2009 15:59:33 +0300, Alexey Chebotar wrote: > >> --- > >> ou=test_root > >> |-- ou=test_child1 > >> | |-- dc=test_domain1 > >> | |-- ou=test_child1_child1 > >> |-- ou=test_child2 > >> | |-- dc=test_domain2 > >> ou=test_root2 > >> --- > Can I, somehow, get children from parent, with different > objectClass than parent? Or parent from entry with different > objectClass? > >>> test_child1 = OrgUnit.find "test_child1" > => #, > must:, may:<...>, ..., ou: ["test_child1"], > ...> >>> test_child1.children > => # @owner=#, > must:, may:<...>, ..., ou: ["test_child1"], > ...>, @options={}, @target=[], @loaded=false> >>> test_child1.children.reload > => [#, > must:, may:<...>, ..., ou: > ["test_child1_child1"], ...>] >>> test_child1.children.target > => [#, > must:, may:<...>, ..., ou: > ["test_child1_child1"], ....>] > >>> test_domain1 = TestDomain.find "test_domain1" > => #, must: objectClass>, may:<...>, ..., dc: ["test_domain1"], ...> >>> test_domain1.parent > => nil What about using generic class? class Entry < ActiveLdap::Base ldap_mapping :prefix => "", :classes => ["top"], :scope => :sub self.dn_attribute = nil end test_child1 = Entry.find(:all, "ou=test_child1") test_child1.children # => dc=test_domain1, ou=test_child1_child1 test_child1.children[0].parent # => dc=test_child1 Thanks, -- kou From kou at cozmixng.org Tue Jun 23 09:32:29 2009 From: kou at cozmixng.org (Kouhei Sutou) Date: Tue, 23 Jun 2009 22:32:29 +0900 (JST) Subject: [activeldap-discuss] [RFC] better names for has_many and belongs_to(:many) Message-ID: <20090623.223229.4959786962498738.kou@cozmixng.org> Hi, I want to hear your comments about better names for has_many and belongs_to(:many). ActiveLdap has 4 associations: has_many, has_many(:wrap), belongs_to and belongs_to(:many). They has :primary_key and/or :foreign_key options. We are a little confused about them. See the below matrix. (Thanks to tashen!) Primary Key Reference Key Return Value ---------- ----------- --------- belongs_to Other's My singular :primary_key :foreign_key belongs_to(:many) My Other's plural :foreign_key :many has_many My Other's plural :foreign_key :primary_key has_many(:wrap) Other's My plural :primary_key :wrap class Group < ActiveLdap::Base ldap_mapping :dn_attribute => "cn", :classes => ['posixGroup'] # has_many(:wrap) has_many :members, :class_name => "User", :wrap => "memberUid", # Group#memberUid :primary_key => "uid", # User#uid # has_many has_many :primary_members, :class_name => 'User', :foreign_key => 'gidNumber', # Group#gidNumber :primary_key => 'gidNumber' # User#gidNumber end class User < ActiveLdap::Base ldap_mapping :dn_attribute => 'uid', :prefix => 'ou=People', :classes => ['person', 'posixAccount'] # belongs_to belongs_to :primary_group, :class_name => "Group", :foreign_key => "gidNumber", # User#gidNumber :primary_key => "gidNumber" # Group#gidNumber # belongs_to(:many) belongs_to :groups, :many => 'memberUid', # Group#memberUid :foreign_key => 'uid # User#uid end tashen suggests me that we should change the current behavior like the following matrix: '*' shows items that we should change. Primary Key Reference Key Return Value ----------- ------------- ------------ belongs_to Other's My singular :primary_key :foreign_key * belongs_to(:many) My Other's plural * :primary_key :many * has_many My Other's plural * :primary_key * :foreign_key has_many(:wrap) Other's My plural :primary_key :wrap I want to accept tashen's suggestion but we should not break API backward compatibility. So I want to use new names for has_many and belongs_to(:many) and keep the current APIs with warning messages. But I don't have a good idea for it. Could you tell me more better names for belongs_to(:many) and has_many that represents their behavior? # tashen, please follow up if I miss information. Thanks, -- kou From tashen.hatena at gmail.com Tue Jun 23 13:41:36 2009 From: tashen.hatena at gmail.com (tashen) Date: Wed, 24 Jun 2009 02:41:36 +0900 Subject: [activeldap-discuss] [RFC] better names for has_many and belongs_to(:many) In-Reply-To: <20090623.223229.4959786962498738.kou@cozmixng.org> References: <20090623.223229.4959786962498738.kou@cozmixng.org> Message-ID: <4A4113D0.6000508@gmail.com> Hi, kou: > # tashen, please follow up if I miss information. I think that was mentioned enough. All: Please comment for solving this. Regards. Kouhei Sutou wrote: > Hi, > > I want to hear your comments about better names for has_many > and belongs_to(:many). > > > ActiveLdap has 4 associations: has_many, has_many(:wrap), > belongs_to and belongs_to(:many). They has :primary_key > and/or :foreign_key options. We are a little confused about > them. See the below matrix. (Thanks to tashen!) > > > Primary Key Reference Key Return Value > ---------- ----------- --------- > belongs_to Other's My singular > :primary_key :foreign_key > > belongs_to(:many) My Other's plural > :foreign_key :many > > has_many My Other's plural > :foreign_key :primary_key > > has_many(:wrap) Other's My plural > :primary_key :wrap > > class Group < ActiveLdap::Base > ldap_mapping :dn_attribute => "cn", > :classes => ['posixGroup'] > > # has_many(:wrap) > has_many :members, :class_name => "User", > :wrap => "memberUid", # Group#memberUid > :primary_key => "uid", # User#uid > > # has_many > has_many :primary_members, :class_name => 'User', > :foreign_key => 'gidNumber', # Group#gidNumber > :primary_key => 'gidNumber' # User#gidNumber > end > > class User < ActiveLdap::Base > ldap_mapping :dn_attribute => 'uid', :prefix => 'ou=People', > :classes => ['person', 'posixAccount'] > > # belongs_to > belongs_to :primary_group, :class_name => "Group", > :foreign_key => "gidNumber", # User#gidNumber > :primary_key => "gidNumber" # Group#gidNumber > > # belongs_to(:many) > belongs_to :groups, > :many => 'memberUid', # Group#memberUid > :foreign_key => 'uid # User#uid > end > > > tashen suggests me that we should change the current > behavior like the following matrix: > > '*' shows items that we should change. > > Primary Key Reference Key Return Value > ----------- ------------- ------------ > belongs_to Other's My singular > :primary_key :foreign_key > > * belongs_to(:many) My Other's plural > * :primary_key :many > > * has_many My Other's plural > * :primary_key * :foreign_key > > has_many(:wrap) Other's My plural > :primary_key :wrap > > I want to accept tashen's suggestion but we should not break > API backward compatibility. So I want to use new names for > has_many and belongs_to(:many) and keep the current APIs > with warning messages. > > But I don't have a good idea for it. Could you tell me > more better names for belongs_to(:many) and has_many that > represents their behavior? > > > # tashen, please follow up if I miss information. > > > Thanks, > -- > kou > _______________________________________________ > ruby-activeldap-discuss mailing list > ruby-activeldap-discuss at rubyforge.org > http://rubyforge.org/mailman/listinfo/ruby-activeldap-discuss -- tashen (Kazuaki Takase) http://d.hatena.ne.jp/tashen From MR-Mencel at wiu.edu Wed Jun 24 18:23:47 2009 From: MR-Mencel at wiu.edu (Matt Mencel) Date: Wed, 24 Jun 2009 17:23:47 -0500 (CDT) Subject: [activeldap-discuss] Adding LDAP User to the Apps User model In-Reply-To: <1802594913.3360391245881895290.JavaMail.root@zcs10> Message-ID: <2067542649.3360801245882227217.JavaMail.root@zcs10> In my rails app I am adding users automatically to my User model when they login and authenticate against LDAP. I just want to see if anyone thinks there is a better way to do it. Thanks, Matt #app/controllers/login_controller.rb class LoginController < ApplicationController def login if session[:person] = LdapUser.authenticate(params[:login][:name], params[:login][:password]) session[:username] = params[:login][:name] if !User.exists?(:uid => params[:login][:name]) ldapuser = LdapUser.find(params[:login][:name]) u = User.create(:uid => ldapuser.uid, :mail => ldapuser.mail, :wiuid => ldapuser.wiuid) end end end end #app/models/ldap_user.rb class LdapUser < ActiveLdap::Base ldap_mapping :dn_attribute => "uid", :prefix => "ou=people" def empty?() self.have_attribute?("dn") end def self.authenticate(username, password) return false if username.empty? or password.empty? find(username).authenticated?(password) end def authenticated?(password) bind(password) remove_connection true rescue ActiveLdap::AuthenticationError, ActiveLdap::LdapError::UnwillingToPerform false end end From tommyblue at lilik.it Tue Jun 30 07:47:32 2009 From: tommyblue at lilik.it (TommyBlue) Date: Tue, 30 Jun 2009 13:47:32 +0200 Subject: [activeldap-discuss] Spaces problem Message-ID: <4A49FB54.6020803@lilik.it> Hi everybody, i'm facing problems with spaces in searches. My class uses cn as dn attribute: class Account < ActiveLdap::Base ldap_mapping :dn_attribute => 'cn', :prefix => 'ou=users', :classes => ['top', 'InetOrgPerson', 'posixAccount', 'shadowAccount'], :scope => :one end With a simple search like this: Account.find(:all, "a b") i get this error: Net::LDAP::LdapError: invalid filter syntax from /usr/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap/filter.rb:302:in `initialize' from /usr/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap/filter.rb:283:in `new' from /usr/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap/filter.rb:283:in `construct' from /usr/lib/ruby/gems/1.8/gems/ruby-net-ldap-0.0.4/lib/net/ldap.rb:1128:in `search' from /home/tommyblue/.gem/ruby/1.8/gems/activeldap-1.0.9/lib/active_ldap/adapter/net_ldap.rb:135:in `send' from /home/tommyblue/.gem/ruby/1.8/gems/activeldap-1.0.9/lib/active_ldap/adapter/net_ldap.rb:135:in `execute' from /home/tommyblue/.gem/ruby/1.8/gems/activeldap-1.0.9/lib/active_ldap/adapter/base.rb:646:in `log' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/core_ext/benchmark.rb:10:in `realtime' from /home/tommyblue/.gem/ruby/1.8/gems/activeldap-1.0.9/lib/active_ldap/adapter/base.rb:646:in `log' from /home/tommyblue/.gem/ruby/1.8/gems/activeldap-1.0.9/lib/active_ldap/adapter/net_ldap.rb:135:in `execute' from /home/tommyblue/.gem/ruby/1.8/gems/activeldap-1.0.9/lib/active_ldap/adapter/net_ldap.rb:78:in `search' from /home/tommyblue/.gem/ruby/1.8/gems/activeldap-1.0.9/lib/active_ldap/adapter/base.rb:165:in `search' from /home/tommyblue/.gem/ruby/1.8/gems/activeldap-1.0.9/lib/active_ldap/adapter/base.rb:266:in `operation' from /home/tommyblue/.gem/ruby/1.8/gems/activeldap-1.0.9/lib/active_ldap/timeout.rb:15:in `call' from /home/tommyblue/.gem/ruby/1.8/gems/activeldap-1.0.9/lib/active_ldap/timeout.rb:15:in `alarm' from /home/tommyblue/.gem/ruby/1.8/gems/activeldap-1.0.9/lib/active_ldap/adapter/base.rb:312:in `with_timeout' from /home/tommyblue/.gem/ruby/1.8/gems/activeldap-1.0.9/lib/active_ldap/adapter/base.rb:265:in `operation' from /home/tommyblue/.gem/ruby/1.8/gems/activeldap-1.0.9/lib/active_ldap/adapter/base.rb:164:in `search' from /home/tommyblue/.gem/ruby/1.8/gems/activeldap-1.0.9/lib/active_ldap/adapter/net_ldap.rb:66:in `search' from /home/tommyblue/.gem/ruby/1.8/gems/activeldap-1.0.9/lib/active_ldap/operations.rb:65:in `search' from /home/tommyblue/.gem/ruby/1.8/gems/activeldap-1.0.9/lib/active_ldap/operations.rb:269:in `find_every' from /home/tommyblue/.gem/ruby/1.8/gems/activeldap-1.0.9/lib/active_ldap/operations.rb:213:in `find' This is the extract from development.log: LDAP: search: FAILED (0.0ms): {:attributes=>[], :scope=>:sub, :filter=>"(&(cn=a b)(&(objectClass=top)(objectClass=InetOrgPerson)(objectClass=posixAccount)(objectClass=shadowAccount)))", :base=>"ou=utenti,dc=lilik,dc=it", :error=>"Net::LDAP::LdapError", :error_message=>"invalid filter syntax"} I've tried to escape the space with "a\sb" and "a\ b" but i get the same error. Without space (eg. Account.find(:all, "ab") ) everything works well. The same error appears when i create a new object which cn contains a space. Thanks in advance, Tommaso -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 3622 bytes Desc: S/MIME Cryptographic Signature URL: From alexey.chebotar at gmail.com Tue Jun 30 10:26:18 2009 From: alexey.chebotar at gmail.com (Alexey Chebotar) Date: Tue, 30 Jun 2009 17:26:18 +0300 Subject: [activeldap-discuss] Spaces problem In-Reply-To: <4A49FB54.6020803@lilik.it> References: <4A49FB54.6020803@lilik.it> Message-ID: <4A4A208A.60806@gmail.com> Hi TommyBlue. I think it is problem of Net::LDAP library. I can't reproduce this problem with library Ruby/LDAP I has created new Account from console, and then tried find them: >> Account.find(:all, "a b") => [#, must:, may:, audio: [], businessCategory: [], carLicense: [], cn: ["a b"], commonName: ["a b"], departmentNumber: [], description: [], destinationIndicator: [], displayName: [], employeeNumber: [], employeeType: [], facsimileTelephoneNumber: [], fax: [], gecos: [], gidNumber: [10000], givenName: [], gn: [], homeDirectory: ["/home/ab"], homePhone: [], homePostalAddress: [], homeTelephoneNumber: [], initials: [], internationaliSDNNumber: [], jpegPhoto: [], l: [], labeledURI: [], localityName: [], loginShell: [], mail: [], manager: [], mobile: [], mobileTelephoneNumber: [], o: [], objectClass: ["top", "inetOrgPerson", "posixAccount", "shadowAccount"], organizationName: [], organizationalUnitName: [], ou: [], pager: [], pagerTelephoneNumber: [], photo: [], physicalDeliveryOfficeName: [], postOfficeBox: [], postalAddress: [], postalCode: [], preferredDeliveryMethod: [], preferredLanguage: [], registeredAddress: [], rfc822Mailbox: [], roomNumber: [], secretary: [], seeAlso: [], shadowExpire: [], shadowFlag: [], shadowInactive: [], shadowLastChange: [], shadowMax: [], shadowMin: [], shadowWarning: [], sn: ["A B"], st: [], stateOrProvinceName: [], street: [], streetAddress: [], surname: ["A B"], telephoneNumber: [], teletexTerminalIdentifier: [], telexNumber: [], title: [], uid: ["ab"], uidNumber: [10000], userCertificate: [], userPKCS12: [], userPassword: [], userSMIMECertificate: [], userid: ["ab"], x121Address: [], x500UniqueIdentifier: []>] Cut from log file: LDAP: add (92.0ms): {:dn=>"cn=a b,ou=domains,dc=...,dc=com", :attributes=>[[:add, "cn", {"cn"=>["a b"]}], [:add, "objectClass", {"objectClass"=>["top", "InetOrgPerson", "posixAccount", "shadowAccount"]}], [:add, "uid", {"uid"=>["ab"]}], [:add, "uidNumber", {"uidNumber"=>["10000"]}], [:add, "sn", {"sn"=>["A B"]}], [:add, "gidNumber", {"gidNumber"=>["10000"]}], [:add, "homeDirectory", {"homeDirectory"=>["/home/ab"]}]]} LDAP: search (3.9ms): {:base=>"ou=domains,dc=...,dc=com", :scope=>:one, :filter=>"(&(cn=a b)(&(objectClass=top)(objectClass=InetOrgPerson)(objectClass=posixAccount)(objectClass=shadowAccount)))", :attributes=>[]} > i'm facing problems with spaces in searches. My class uses cn as dn > attribute: > > class Account < ActiveLdap::Base > ldap_mapping :dn_attribute => 'cn', > :prefix => 'ou=users', > :classes => ['top', 'InetOrgPerson', 'posixAccount', > 'shadowAccount'], > :scope => :one > end > > With a simple search like this: > > Account.find(:all, "a b") > > i get this error: > > Net::LDAP::LdapError: invalid filter syntax From tommyblue at lilik.it Tue Jun 30 11:54:18 2009 From: tommyblue at lilik.it (TommyBlue) Date: Tue, 30 Jun 2009 17:54:18 +0200 Subject: [activeldap-discuss] Spaces problem In-Reply-To: <4A4A208A.60806@gmail.com> References: <4A49FB54.6020803@lilik.it> <4A4A208A.60806@gmail.com> Message-ID: <4A4A352A.2030305@lilik.it> ok, thanks for suggest, i'll dig it up! :) Il 30/06/2009 16:26, Alexey Chebotar ha scritto: > Hi TommyBlue. > I think it is problem of Net::LDAP library. I can't reproduce this > problem with library Ruby/LDAP > > I has created new Account from console, and then tried find them: > > >> Account.find(:all, "a b") > => [# shadowAccount>, must: uid, uidNumber>, may: departmentNumber, description, destinationIndicator, displayName, > employeeNumber, employeeType, facsimileTelephoneNumber, gecos, > givenName, homePhone, homePostalAddress, initials, > internationaliSDNNumber, jpegPhoto, l, labeledURI, loginShell, mail, > manager, mobile, o, ou, pager, photo, physicalDeliveryOfficeName, > postOfficeBox, postalAddress, postalCode, preferredDeliveryMethod, > preferredLanguage, registeredAddress, roomNumber, secretary, seeAlso, > shadowExpire, shadowFlag, shadowInactive, shadowLastChange, shadowMax, > shadowMin, shadowWarning, st, street, telephoneNumber, > teletexTerminalIdentifier, telexNumber, title, uid, userCertificate, > userPKCS12, userPassword, userSMIMECertificate, x121Address, > x500UniqueIdentifier>, audio: [], businessCategory: [], carLicense: [], > cn: ["a b"], commonName: ["a b"], departmentNumber: [], description: [], > destinationIndicator: [], displayName: [], employeeNumber: [], > employeeType: [], facsimileTelephoneNumber: [], fax: [], gecos: [], > gidNumber: [10000], givenName: [], gn: [], homeDirectory: ["/home/ab"], > homePhone: [], homePostalAddress: [], homeTelephoneNumber: [], initials: > [], internationaliSDNNumber: [], jpegPhoto: [], l: [], labeledURI: [], > localityName: [], loginShell: [], mail: [], manager: [], mobile: [], > mobileTelephoneNumber: [], o: [], objectClass: ["top", "inetOrgPerson", > "posixAccount", "shadowAccount"], organizationName: [], > organizationalUnitName: [], ou: [], pager: [], pagerTelephoneNumber: [], > photo: [], physicalDeliveryOfficeName: [], postOfficeBox: [], > postalAddress: [], postalCode: [], preferredDeliveryMethod: [], > preferredLanguage: [], registeredAddress: [], rfc822Mailbox: [], > roomNumber: [], secretary: [], seeAlso: [], shadowExpire: [], > shadowFlag: [], shadowInactive: [], shadowLastChange: [], shadowMax: [], > shadowMin: [], shadowWarning: [], sn: ["A B"], st: [], > stateOrProvinceName: [], street: [], streetAddress: [], surname: ["A > B"], telephoneNumber: [], teletexTerminalIdentifier: [], telexNumber: > [], title: [], uid: ["ab"], uidNumber: [10000], userCertificate: [], > userPKCS12: [], userPassword: [], userSMIMECertificate: [], userid: > ["ab"], x121Address: [], x500UniqueIdentifier: []>] > > Cut from log file: > > LDAP: add (92.0ms): {:dn=>"cn=a b,ou=domains,dc=...,dc=com", > :attributes=>[[:add, "cn", {"cn"=>["a b"]}], [:add, "objectClass", > {"objectClass"=>["top", "InetOrgPerson", "posixAccount", > "shadowAccount"]}], [:add, "uid", {"uid"=>["ab"]}], [:add, "uidNumber", > {"uidNumber"=>["10000"]}], [:add, "sn", {"sn"=>["A B"]}], [:add, > "gidNumber", {"gidNumber"=>["10000"]}], [:add, "homeDirectory", > {"homeDirectory"=>["/home/ab"]}]]} > LDAP: search (3.9ms): {:base=>"ou=domains,dc=...,dc=com", :scope=>:one, > :filter=>"(&(cn=a > b)(&(objectClass=top)(objectClass=InetOrgPerson)(objectClass=posixAccount)(objectClass=shadowAccount)))", > :attributes=>[]} > >> i'm facing problems with spaces in searches. My class uses cn as dn >> attribute: >> >> class Account < ActiveLdap::Base >> ldap_mapping :dn_attribute => 'cn', >> :prefix => 'ou=users', >> :classes => ['top', 'InetOrgPerson', 'posixAccount', 'shadowAccount'], >> :scope => :one >> end >> >> With a simple search like this: >> >> Account.find(:all, "a b") >> >> i get this error: >> >> Net::LDAP::LdapError: invalid filter syntax > > _______________________________________________ > ruby-activeldap-discuss mailing list > ruby-activeldap-discuss at rubyforge.org > http://rubyforge.org/mailman/listinfo/ruby-activeldap-discuss -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 3622 bytes Desc: S/MIME Cryptographic Signature URL: