From codesite-noreply at google.com Sun Oct 4 09:55:05 2009 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Sun, 04 Oct 2009 13:55:05 +0000 Subject: [activeldap-commit] [ruby-activeldap] r1103 committed - * ActiveLdap::Base#attributes returns data that reflects... Message-ID: <001636ed69f92da63604751c5894@google.com> Revision: 1103 Author: koutou Date: Sun Oct 4 06:54:54 2009 Log: * ActiveLdap::Base#attributes returns data that reflects schema definition. [#31] Suggested by Alexey.Chebotar. Thanks!!! http://code.google.com/p/ruby-activeldap/source/detail?r=1103 Modified: /trunk/lib/active_ldap/base.rb /trunk/test/test_base.rb ======================================= --- /trunk/lib/active_ldap/base.rb Mon Sep 21 04:31:03 2009 +++ /trunk/lib/active_ldap/base.rb Sun Oct 4 06:54:54 2009 @@ -902,7 +902,8 @@ # This returns the key value pairs in @data with all values # cloned def attributes - @data.clone + @simplified_data ||= simplify_data(@data) + @simplified_data.clone end # This allows a bulk update to the attributes of a record @@ -1276,6 +1277,7 @@ raise UnknownAttribute.new(name) if real_name.nil? @data[real_name] = value + @simplified_data = nil end def register_new_dn_attribute(name, value) @@ -1443,6 +1445,19 @@ result end + def simplify_data(data) + _schema = schema + result = {} + data.each do |key, values| + attribute = _schema.attribute(key) + if attribute.single_value? and values.is_a?(Array) and values.size == 1 + values = values[0] + end + result[key] = type_cast(attribute, values) + end + result + end + def collect_modified_attributes(ldap_data, data) klass = self.class _dn_attribute = dn_attribute ======================================= --- /trunk/test/test_base.rb Mon Sep 21 19:17:19 2009 +++ /trunk/test/test_base.rb Sun Oct 4 06:54:54 2009 @@ -6,6 +6,18 @@ include AlTestUtils priority :must + def test_attributes + make_temporary_group do |group| + assert_equal({ + "cn" => group.cn, + "gidNumber" => group.gidNumber, + "objectClass" => group.classes, + }, + group.attributes) + end + end + + priority :normal def test_rename_with_superior make_ou("sub,ou=users") make_temporary_user(:simple => true) do |user,| @@ -47,7 +59,6 @@ end end - priority :normal def test_operational_attributes make_temporary_group do |group| dn, attributes = @group_class.search(:attributes => ["*"])[0] From codesite-noreply at google.com Sun Oct 11 22:06:45 2009 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Mon, 12 Oct 2009 02:06:45 +0000 Subject: [activeldap-commit] [ruby-activeldap] r1104 committed - * remove needless cache reset. Message-ID: <001636d33903b38cc50475b361fc@google.com> Revision: 1104 Author: koutou Date: Sun Oct 11 19:05:40 2009 Log: * remove needless cache reset. http://code.google.com/p/ruby-activeldap/source/detail?r=1104 Modified: /trunk/lib/active_ldap/base.rb ======================================= --- /trunk/lib/active_ldap/base.rb Sun Oct 4 06:54:54 2009 +++ /trunk/lib/active_ldap/base.rb Sun Oct 11 19:05:40 2009 @@ -780,7 +780,6 @@ def dn=(value) set_attribute(dn_attribute_with_fallback, value) - @dn = nil end alias_method(:id=, :dn=) From codesite-noreply at google.com Sun Oct 11 22:13:47 2009 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Mon, 12 Oct 2009 02:13:47 +0000 Subject: [activeldap-commit] [ruby-activeldap] r1105 committed - * DN attribute change by mass assignment with :id => ... blocks. Message-ID: <001636c5bd41daf1160475b37af7@google.com> Revision: 1105 Author: koutou Date: Sun Oct 11 19:13:06 2009 Log: * DN attribute change by mass assignment with :id => ... blocks. http://code.google.com/p/ruby-activeldap/source/detail?r=1105 Modified: /trunk/lib/active_ldap/attributes.rb /trunk/test/test_base.rb ======================================= --- /trunk/lib/active_ldap/attributes.rb Sun Aug 16 00:41:04 2009 +++ /trunk/lib/active_ldap/attributes.rb Sun Oct 11 19:13:06 2009 @@ -157,7 +157,13 @@ needless_attributes[to_real_attribute_name(name)] = true end + _dn_attribute = nil + begin + _dn_attribute = dn_attribute_with_fallback + rescue DistinguishedNameInvalid + end targets.collect do |key, value| + key = _dn_attribute if ["id", "dn"].include?(key.to_s) [to_real_attribute_name(key) || key, value] end.reject do |key, value| needless_attributes[key] @@ -165,7 +171,6 @@ end def attributes_protected_by_default - _dn_attribute = nil begin _dn_attribute = dn_attribute_with_fallback rescue DistinguishedNameInvalid ======================================= --- /trunk/test/test_base.rb Sun Oct 4 06:54:54 2009 +++ /trunk/test/test_base.rb Sun Oct 11 19:13:06 2009 @@ -6,6 +6,15 @@ include AlTestUtils priority :must + def test_not_rename_by_mass_update + make_temporary_user(:simple => true) do |user,| + original_id = user.id + assert_true(user.update_attributes(:id => "user2")) + assert_equal(original_id, user.id) + end + end + + priority :normal def test_attributes make_temporary_group do |group| assert_equal({ @@ -17,7 +26,6 @@ end end - priority :normal def test_rename_with_superior make_ou("sub,ou=users") make_temporary_user(:simple => true) do |user,| From codesite-noreply at google.com Thu Oct 15 07:35:42 2009 From: codesite-noreply at google.com (codesite-noreply at google.com) Date: Thu, 15 Oct 2009 11:35:42 +0000 Subject: [activeldap-commit] [ruby-activeldap] r1106 committed - Edited wiki page through web user interface. Message-ID: <005045017e32ec96e70475f7adea@google.com> Revision: 1106 Author: koutou Date: Thu Oct 15 04:34:47 2009 Log: Edited wiki page through web user interface. http://code.google.com/p/ruby-activeldap/source/detail?r=1106 Modified: /wiki/TroubleShooting.wiki ======================================= --- /wiki/TroubleShooting.wiki Tue Feb 3 05:37:51 2009 +++ /wiki/TroubleShooting.wiki Thu Oct 15 04:34:47 2009 @@ -37,6 +37,17 @@ }}} Note that "port: 636" is optional if you are using ActiveLdap >= 1.0.2 or trunk. In the version, ActiveLdap guesses suitable port number from "method" configuration. + += How to access createTimeStamp = + +Pass "+" as :attributes value: + +{{{ +entries = Entry.find(:all, :attributes => ["+", "*"]) +entries.each do |entry| + p entry.create_timestamp +end +}}} = Next problem... =