From null at cozmixng.org Sun Jun 3 05:36:04 2012 From: null at cozmixng.org (null at cozmixng.org) Date: Sun, 03 Jun 2012 14:36:04 +0900 Subject: [activeldap-commit] activeldap/activeldap [master] Honoring attributes arguments when passed to find. Message-ID: <20120611214200.BA9A2940151@jenkins.clear-code.com> The Mechanic 2012-06-03 14:36:04 +0900 (Sun, 03 Jun 2012) New Revision: 50e0733234e767ce04e583909931a82f6797821f Merged 862f310: Merge pull request #41 from unixmechanic/master Log: Honoring attributes arguments when passed to find. Modified files: lib/active_ldap/operations.rb Modified: lib/active_ldap/operations.rb (+11 -7) =================================================================== --- lib/active_ldap/operations.rb 2012-05-24 22:22:18 +0900 (308fdd5) +++ lib/active_ldap/operations.rb 2012-06-03 14:36:04 +0900 (7f78a21) @@ -31,6 +31,7 @@ module ActiveLdap filter = options[:filter] prefix = options[:prefix] classes = options[:classes] + attributes_filter = options[:attributes] value = value.first if value.is_a?(Array) and value.first.size == 1 @@ -60,16 +61,19 @@ module ActiveLdap :sort_by => options[:sort_by] || sort_by, :order => options[:order] || order, } - options[:connection] ||= connection values = [] options[:connection].search(search_options) do |dn, attrs| attributes = {} + normalized_attributes = {} attrs.each do |key, _value| - normalized_attr, normalized_value = - normalize_attribute_options(key, _value) - attributes[normalized_attr] ||= [] - attributes[normalized_attr].concat(normalized_value) + if attributes_filter.include?(key) || attributes_filter.include?('*') + normalized_attribute, normalized_value = normalize_attribute_options(key, _value) + attributes[normalized_attribute] ||= [] + attributes[normalized_attribute].concat(normalized_value) + else + next + end end values << [dn, attributes] end @@ -281,8 +285,8 @@ module ActiveLdap order = options.delete(:order) || self.order limit = options.delete(:limit) if sort_by or order offset = options.delete(:offset) || offset - options[:attributes] |= ["objectClass"] if options[:attributes] - + options[:attributes] = options.delete(:attributes) || ['*'] + options[:attributes] |= ['objectClass'] results = search(options).collect do |dn, attrs| instantiate([dn, attrs, {:connection => options[:connection]}]) end From null at cozmixng.org Sun Jun 3 05:41:17 2012 From: null at cozmixng.org (null at cozmixng.org) Date: Sun, 03 Jun 2012 14:41:17 +0900 Subject: [activeldap-commit] activeldap/activeldap [master] Indentation fixes. Message-ID: <20120611214201.42831940BAA@jenkins.clear-code.com> unixmechanic 2012-06-03 14:41:17 +0900 (Sun, 03 Jun 2012) New Revision: 9c37778db90466cb747b2ff9a0c5085612eb1ef0 Merged 862f310: Merge pull request #41 from unixmechanic/master Log: Indentation fixes. Modified files: lib/active_ldap/operations.rb Modified: lib/active_ldap/operations.rb (+3 -3) =================================================================== --- lib/active_ldap/operations.rb 2012-06-03 14:36:04 +0900 (7f78a21) +++ lib/active_ldap/operations.rb 2012-06-03 14:41:17 +0900 (8532a3c) @@ -65,13 +65,13 @@ module ActiveLdap values = [] options[:connection].search(search_options) do |dn, attrs| attributes = {} - normalized_attributes = {} + normalized_attributes = {} attrs.each do |key, _value| if attributes_filter.include?(key) || attributes_filter.include?('*') normalized_attribute, normalized_value = normalize_attribute_options(key, _value) attributes[normalized_attribute] ||= [] - attributes[normalized_attribute].concat(normalized_value) - else + attributes[normalized_attribute].concat(normalized_value) + else next end end From null at cozmixng.org Mon Jun 11 21:42:01 2012 From: null at cozmixng.org (null at cozmixng.org) Date: Tue, 12 Jun 2012 06:42:01 +0900 Subject: [activeldap-commit] activeldap/activeldap [master] Merge pull request #41 from unixmechanic/master Message-ID: <20120611214201.99345940BC9@jenkins.clear-code.com> Kouhei Sutou 2012-06-12 06:42:01 +0900 (Tue, 12 Jun 2012) New Revision: 862f3102740ef4fa2f9843acaddb1227264163e8 Log: Merge pull request #41 from unixmechanic/master Honoring attributes in .find() arguments Patch by unixmechanic. Thanks!!! From null at cozmixng.org Mon Jun 11 21:54:02 2012 From: null at cozmixng.org (null at cozmixng.org) Date: Tue, 12 Jun 2012 06:54:02 +0900 Subject: [activeldap-commit] activeldap/activeldap [master] Use spaces instead of tabs for indentation Message-ID: <20120611215645.C140E940151@jenkins.clear-code.com> Kouhei Sutou 2012-06-12 06:54:02 +0900 (Tue, 12 Jun 2012) New Revision: f91d9ae338a7447b8ebea21ace7145e71cef9c44 Log: Use spaces instead of tabs for indentation Modified files: lib/active_ldap/operations.rb Modified: lib/active_ldap/operations.rb (+11 -11) =================================================================== --- lib/active_ldap/operations.rb 2012-06-12 06:42:01 +0900 (8532a3c) +++ lib/active_ldap/operations.rb 2012-06-12 06:54:02 +0900 (65b2cd1) @@ -31,7 +31,7 @@ module ActiveLdap filter = options[:filter] prefix = options[:prefix] classes = options[:classes] - attributes_filter = options[:attributes] + attributes_filter = options[:attributes] value = value.first if value.is_a?(Array) and value.first.size == 1 @@ -65,15 +65,15 @@ module ActiveLdap values = [] options[:connection].search(search_options) do |dn, attrs| attributes = {} - normalized_attributes = {} + normalized_attributes = {} attrs.each do |key, _value| - if attributes_filter.include?(key) || attributes_filter.include?('*') - normalized_attribute, normalized_value = normalize_attribute_options(key, _value) - attributes[normalized_attribute] ||= [] - attributes[normalized_attribute].concat(normalized_value) - else - next - end + if attributes_filter.include?(key) || attributes_filter.include?('*') + normalized_attribute, normalized_value = normalize_attribute_options(key, _value) + attributes[normalized_attribute] ||= [] + attributes[normalized_attribute].concat(normalized_value) + else + next + end end values << [dn, attributes] end @@ -285,8 +285,8 @@ module ActiveLdap order = options.delete(:order) || self.order limit = options.delete(:limit) if sort_by or order offset = options.delete(:offset) || offset - options[:attributes] = options.delete(:attributes) || ['*'] - options[:attributes] |= ['objectClass'] + options[:attributes] = options.delete(:attributes) || ['*'] + options[:attributes] |= ['objectClass'] results = search(options).collect do |dn, attrs| instantiate([dn, attrs, {:connection => options[:connection]}]) end From null at cozmixng.org Mon Jun 11 21:56:42 2012 From: null at cozmixng.org (null at cozmixng.org) Date: Tue, 12 Jun 2012 06:56:42 +0900 Subject: [activeldap-commit] activeldap/activeldap [master] Accept nil for :attributes Message-ID: <20120611215645.E7F45940BAA@jenkins.clear-code.com> Kouhei Sutou 2012-06-12 06:56:42 +0900 (Tue, 12 Jun 2012) New Revision: 3868198a166743898fef13d776d322768933fdf4 Log: Accept nil for :attributes Modified files: lib/active_ldap/operations.rb Modified: lib/active_ldap/operations.rb (+1 -1) =================================================================== --- lib/active_ldap/operations.rb 2012-06-12 06:54:02 +0900 (65b2cd1) +++ lib/active_ldap/operations.rb 2012-06-12 06:56:42 +0900 (c883caf) @@ -67,7 +67,7 @@ module ActiveLdap attributes = {} normalized_attributes = {} attrs.each do |key, _value| - if attributes_filter.include?(key) || attributes_filter.include?('*') + if attributes_filter.nil? || attributes_filter.include?(key) || attributes_filter.include?('*') normalized_attribute, normalized_value = normalize_attribute_options(key, _value) attributes[normalized_attribute] ||= [] attributes[normalized_attribute].concat(normalized_value) From null at cozmixng.org Mon Jun 11 21:57:12 2012 From: null at cozmixng.org (null at cozmixng.org) Date: Tue, 12 Jun 2012 06:57:12 +0900 Subject: [activeldap-commit] activeldap/activeldap [master] Use 'or' instead of '||' Message-ID: <20120611215716.4AB22940151@jenkins.clear-code.com> Kouhei Sutou 2012-06-12 06:57:12 +0900 (Tue, 12 Jun 2012) New Revision: 8fa72cf42d4bf533b97d43b1bca771542374cf16 Log: Use 'or' instead of '||' Modified files: lib/active_ldap/operations.rb Modified: lib/active_ldap/operations.rb (+1 -1) =================================================================== --- lib/active_ldap/operations.rb 2012-06-12 06:56:42 +0900 (c883caf) +++ lib/active_ldap/operations.rb 2012-06-12 06:57:12 +0900 (d385731) @@ -67,7 +67,7 @@ module ActiveLdap attributes = {} normalized_attributes = {} attrs.each do |key, _value| - if attributes_filter.nil? || attributes_filter.include?(key) || attributes_filter.include?('*') + if attributes_filter.nil? or attributes_filter.include?(key) or attributes_filter.include?('*') normalized_attribute, normalized_value = normalize_attribute_options(key, _value) attributes[normalized_attribute] ||= [] attributes[normalized_attribute].concat(normalized_value) From null at cozmixng.org Mon Jun 11 21:57:32 2012 From: null at cozmixng.org (null at cozmixng.org) Date: Tue, 12 Jun 2012 06:57:32 +0900 Subject: [activeldap-commit] activeldap/activeldap [master] Remove an unused variable Message-ID: <20120611215735.E5893940151@jenkins.clear-code.com> Kouhei Sutou 2012-06-12 06:57:32 +0900 (Tue, 12 Jun 2012) New Revision: 62dcb60b24e655c8d149ba1dd5b58e461741f5b7 Log: Remove an unused variable Modified files: lib/active_ldap/operations.rb Modified: lib/active_ldap/operations.rb (+0 -1) =================================================================== --- lib/active_ldap/operations.rb 2012-06-12 06:57:12 +0900 (d385731) +++ lib/active_ldap/operations.rb 2012-06-12 06:57:32 +0900 (4b65ca3) @@ -65,7 +65,6 @@ module ActiveLdap values = [] options[:connection].search(search_options) do |dn, attrs| attributes = {} - normalized_attributes = {} attrs.each do |key, _value| if attributes_filter.nil? or attributes_filter.include?(key) or attributes_filter.include?('*') normalized_attribute, normalized_value = normalize_attribute_options(key, _value) From null at cozmixng.org Mon Jun 11 21:59:30 2012 From: null at cozmixng.org (null at cozmixng.org) Date: Tue, 12 Jun 2012 06:59:30 +0900 Subject: [activeldap-commit] activeldap/activeldap [master] attributes_filter -> required_attributes Message-ID: <20120611215934.24BEC940151@jenkins.clear-code.com> Kouhei Sutou 2012-06-12 06:59:30 +0900 (Tue, 12 Jun 2012) New Revision: 3547e5a4202b9072e284c7e05e43a2c8c4bcdc16 Log: attributes_filter -> required_attributes Modified files: lib/active_ldap/operations.rb Modified: lib/active_ldap/operations.rb (+2 -2) =================================================================== --- lib/active_ldap/operations.rb 2012-06-12 06:57:32 +0900 (4b65ca3) +++ lib/active_ldap/operations.rb 2012-06-12 06:59:30 +0900 (9f8442a) @@ -31,7 +31,7 @@ module ActiveLdap filter = options[:filter] prefix = options[:prefix] classes = options[:classes] - attributes_filter = options[:attributes] + required_attributes = options[:attributes] value = value.first if value.is_a?(Array) and value.first.size == 1 @@ -66,7 +66,7 @@ module ActiveLdap options[:connection].search(search_options) do |dn, attrs| attributes = {} attrs.each do |key, _value| - if attributes_filter.nil? or attributes_filter.include?(key) or attributes_filter.include?('*') + if required_attributes.nil? or required_attributes.include?(key) or required_attributes.include?('*') normalized_attribute, normalized_value = normalize_attribute_options(key, _value) attributes[normalized_attribute] ||= [] attributes[normalized_attribute].concat(normalized_value) From null at cozmixng.org Mon Jun 11 22:00:17 2012 From: null at cozmixng.org (null at cozmixng.org) Date: Tue, 12 Jun 2012 07:00:17 +0900 Subject: [activeldap-commit] activeldap/activeldap [master] required -> requested Message-ID: <20120611220020.263CE940151@jenkins.clear-code.com> Kouhei Sutou 2012-06-12 07:00:17 +0900 (Tue, 12 Jun 2012) New Revision: edebbe7dcea7f51f4ef3d6bdbfc9f35f4b3b1798 Log: required -> requested Modified files: lib/active_ldap/operations.rb Modified: lib/active_ldap/operations.rb (+2 -2) =================================================================== --- lib/active_ldap/operations.rb 2012-06-12 06:59:30 +0900 (9f8442a) +++ lib/active_ldap/operations.rb 2012-06-12 07:00:17 +0900 (38e5847) @@ -31,7 +31,7 @@ module ActiveLdap filter = options[:filter] prefix = options[:prefix] classes = options[:classes] - required_attributes = options[:attributes] + requested_attributes = options[:attributes] value = value.first if value.is_a?(Array) and value.first.size == 1 @@ -66,7 +66,7 @@ module ActiveLdap options[:connection].search(search_options) do |dn, attrs| attributes = {} attrs.each do |key, _value| - if required_attributes.nil? or required_attributes.include?(key) or required_attributes.include?('*') + if requested_attributes.nil? or requested_attributes.include?(key) or requested_attributes.include?('*') normalized_attribute, normalized_value = normalize_attribute_options(key, _value) attributes[normalized_attribute] ||= [] attributes[normalized_attribute].concat(normalized_value) From null at cozmixng.org Mon Jun 11 22:00:35 2012 From: null at cozmixng.org (null at cozmixng.org) Date: Tue, 12 Jun 2012 07:00:35 +0900 Subject: [activeldap-commit] activeldap/activeldap [master] Use variable Message-ID: <20120611220040.5593F940151@jenkins.clear-code.com> Kouhei Sutou 2012-06-12 07:00:35 +0900 (Tue, 12 Jun 2012) New Revision: 484cab66eb0b8ce47365d32c61074ffa551aa313 Log: Use variable Modified files: lib/active_ldap/operations.rb Modified: lib/active_ldap/operations.rb (+1 -1) =================================================================== --- lib/active_ldap/operations.rb 2012-06-12 07:00:17 +0900 (38e5847) +++ lib/active_ldap/operations.rb 2012-06-12 07:00:35 +0900 (aa210c0) @@ -57,7 +57,7 @@ module ActiveLdap :scope => options[:scope] || scope, :filter => filter, :limit => options[:limit], - :attributes => options[:attributes], + :attributes => requested_attributes, :sort_by => options[:sort_by] || sort_by, :order => options[:order] || order, } From null at cozmixng.org Mon Jun 11 22:02:32 2012 From: null at cozmixng.org (null at cozmixng.org) Date: Tue, 12 Jun 2012 07:02:32 +0900 Subject: [activeldap-commit] activeldap/activeldap [master] Reduce needless condition checks Message-ID: <20120611220236.C4ECA940151@jenkins.clear-code.com> Kouhei Sutou 2012-06-12 07:02:32 +0900 (Tue, 12 Jun 2012) New Revision: cf303faf232e3342b8b86ee2fc824e954f82b089 Log: Reduce needless condition checks Modified files: lib/active_ldap/operations.rb Modified: lib/active_ldap/operations.rb (+3 -1) =================================================================== --- lib/active_ldap/operations.rb 2012-06-12 07:00:35 +0900 (aa210c0) +++ lib/active_ldap/operations.rb 2012-06-12 07:02:32 +0900 (fa38678) @@ -63,10 +63,12 @@ module ActiveLdap } options[:connection] ||= connection values = [] + requested_all_attributes = + (requested_attributes.nil? or requested_attributes.include?('*')) options[:connection].search(search_options) do |dn, attrs| attributes = {} attrs.each do |key, _value| - if requested_attributes.nil? or requested_attributes.include?(key) or requested_attributes.include?('*') + if requested_all_attributes or requested_attributes.include?(key) normalized_attribute, normalized_value = normalize_attribute_options(key, _value) attributes[normalized_attribute] ||= [] attributes[normalized_attribute].concat(normalized_value) From null at cozmixng.org Mon Jun 11 22:03:16 2012 From: null at cozmixng.org (null at cozmixng.org) Date: Tue, 12 Jun 2012 07:03:16 +0900 Subject: [activeldap-commit] activeldap/activeldap [master] Break a long line Message-ID: <20120611220320.061FC940151@jenkins.clear-code.com> Kouhei Sutou 2012-06-12 07:03:16 +0900 (Tue, 12 Jun 2012) New Revision: e79c7e4543eda570c92947121e7331e4ed5fd2f7 Log: Break a long line Modified files: lib/active_ldap/operations.rb Modified: lib/active_ldap/operations.rb (+2 -1) =================================================================== --- lib/active_ldap/operations.rb 2012-06-12 07:02:32 +0900 (fa38678) +++ lib/active_ldap/operations.rb 2012-06-12 07:03:16 +0900 (4d4cc70) @@ -69,7 +69,8 @@ module ActiveLdap attributes = {} attrs.each do |key, _value| if requested_all_attributes or requested_attributes.include?(key) - normalized_attribute, normalized_value = normalize_attribute_options(key, _value) + normalized_attribute, normalized_value = + normalize_attribute_options(key, _value) attributes[normalized_attribute] ||= [] attributes[normalized_attribute].concat(normalized_value) else From null at cozmixng.org Mon Jun 11 22:03:56 2012 From: null at cozmixng.org (null at cozmixng.org) Date: Tue, 12 Jun 2012 07:03:56 +0900 Subject: [activeldap-commit] activeldap/activeldap [master] Add _p suffix for boolean variable name Message-ID: <20120611220359.DD569940151@jenkins.clear-code.com> Kouhei Sutou 2012-06-12 07:03:56 +0900 (Tue, 12 Jun 2012) New Revision: 831e6d08b3666b92a65f8733e0242d9b39a30293 Log: Add _p suffix for boolean variable name Modified files: lib/active_ldap/operations.rb Modified: lib/active_ldap/operations.rb (+2 -2) =================================================================== --- lib/active_ldap/operations.rb 2012-06-12 07:03:16 +0900 (4d4cc70) +++ lib/active_ldap/operations.rb 2012-06-12 07:03:56 +0900 (93cf8b3) @@ -63,12 +63,12 @@ module ActiveLdap } options[:connection] ||= connection values = [] - requested_all_attributes = + requested_all_attributes_p = (requested_attributes.nil? or requested_attributes.include?('*')) options[:connection].search(search_options) do |dn, attrs| attributes = {} attrs.each do |key, _value| - if requested_all_attributes or requested_attributes.include?(key) + if requested_all_attributes_p or requested_attributes.include?(key) normalized_attribute, normalized_value = normalize_attribute_options(key, _value) attributes[normalized_attribute] ||= []