activeldap 5.1.1 → 5.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 6843a03bb95047e714ba757d90fcc4072508a7cb
4
- data.tar.gz: e281bb775badcb61da95465dec7c316c51d4bcdf
2
+ SHA256:
3
+ metadata.gz: 8ff0abb4ff702e766243e5ff416b5b526b4ae0f2e0269e4058f00956b27b7de8
4
+ data.tar.gz: 87e13372b42e5b6c8b58012597f5631ebd92d50b213382f5d6f32a90479b4f60
5
5
  SHA512:
6
- metadata.gz: 5ef2d625d33324a495fec527ba79b6b1483c21b885404220b5849af56345c1b08a8852d9c56a4df66b8cd230d21f3c6549190060c4978dc897da74fca2a12867
7
- data.tar.gz: ae643d6b8552d95ed4fe089ba0104bb2347b1f0ed80bfeb2a4901a56e381801008836e640f701c356ecbed5f1a033f84754b78e47ca82611f4be56bc80845221
6
+ metadata.gz: a5b69fb0534269a9fdc2b0eda2882d35a4c74cfde74b3d82af50880e83c49a350f770d18538e6b9fca119aa4ca4c59c9482ca9c447620cdbdfe5327f113a268d
7
+ data.tar.gz: 10c8ebcb314692ed2e2abafe1a9edd39572c617f8ffe540fcc6ca760aff3c8b7ebd6dbf3f1f2af7d0c76097a340fb2c393516629e229e212af82842d5386d3f5
@@ -1,5 +1,21 @@
1
1
  h1. News
2
2
 
3
+ h2(#release-5-2-0). 5.2.0: 2018-05-09
4
+
5
+ h3. Improvements
6
+
7
+ * Added @:dc_base_class@ and @:ou_base_class@ options to
8
+ @ActiveLdap::Populate.ensure_base@.
9
+ [GitHub#153][Patch by hide_24]
10
+
11
+ * Added Active Model 5.2.0 support.
12
+
13
+ * Improved connection error handling for net-ldap.
14
+
15
+ h3. Thanks
16
+
17
+ * hide_24
18
+
3
19
  h2(#release-5-1-1). 5.1.1: 2018-01-17
4
20
 
5
21
  h3. Improvements
@@ -33,8 +33,11 @@ module ActiveLdap
33
33
  info = {:uri => uri, :with_start_tls => with_start_tls}
34
34
  [log("connect", info) {Net::LDAP::Connection.new(config)},
35
35
  uri, with_start_tls]
36
- rescue Net::LDAP::LdapError
37
- raise ConnectionError, $!.message
36
+ rescue Net::LDAP::ConnectionError => error
37
+ raise ConnectionError, error.message
38
+ rescue Net::LDAP::Error => error
39
+ message = "#{error.class}: #{error.message}"
40
+ raise ConnectionError, message, caller(0) + error.backtrace
38
41
  end
39
42
  end
40
43
  end
@@ -50,7 +53,7 @@ module ActiveLdap
50
53
  def bind(options={})
51
54
  begin
52
55
  super
53
- rescue Net::LDAP::LdapError
56
+ rescue Net::LDAP::Error
54
57
  raise AuthenticationError, $!.message
55
58
  end
56
59
  end
@@ -148,8 +151,13 @@ module ActiveLdap
148
151
  result = log(name, info) do
149
152
  begin
150
153
  @connection.send(method, *args, &block)
151
- rescue Errno::EPIPE, Errno::ECONNRESET
152
- raise ConnectionError, "#{$!.class}: #{$!.message}"
154
+ rescue SystemCallError => error
155
+ message = "#{error.class}: #{error.message}"
156
+ raise ConnectionError, message, caller(0) + error.backtrace
157
+ rescue Net::LDAP::ResponseMissingOrInvalidError => error
158
+ message = "#{error.class}: #{error.message}"
159
+ message << ": connection may be timed out"
160
+ raise ConnectionError, message, caller(0) + error.backtrace
153
161
  end
154
162
  end
155
163
  message = nil
@@ -13,8 +13,7 @@ module ActiveLdap
13
13
  end.flatten
14
14
  end
15
15
 
16
- protected
17
-
16
+ private
18
17
  # overiding ActiveModel::AttributeMethods
19
18
  def attribute_method?(method_name)
20
19
  have_attribute?(method_name, ['objectClass'])
@@ -7,7 +7,7 @@ module ActiveLdap
7
7
  attribute_method_suffix '_before_type_cast'
8
8
  end
9
9
 
10
- protected
10
+ private
11
11
  def attribute_before_type_cast(attr)
12
12
  get_attribute_before_type_cast(attr)[1]
13
13
  end
@@ -9,8 +9,7 @@ module ActiveLdap
9
9
  def save(*) #:nodoc:
10
10
  succeeded = super
11
11
  if succeeded
12
- @previously_changed = changes
13
- @changed_attributes.clear
12
+ changes_applied
14
13
  end
15
14
  succeeded
16
15
  end
@@ -18,20 +17,18 @@ module ActiveLdap
18
17
  # Attempts to <tt>save!</tt> the record and clears changed attributes if successful.
19
18
  def save!(*) #:nodoc:
20
19
  super.tap do
21
- @previously_changed = changes
22
- @changed_attributes.clear
20
+ changes_applied
23
21
  end
24
22
  end
25
23
 
26
24
  # <tt>reload</tt> the record and clears changed attributes.
27
25
  def reload(*) #:nodoc:
28
26
  super.tap do
29
- @previously_changed.clear
30
- @changed_attributes.clear
27
+ clear_changes_information
31
28
  end
32
29
  end
33
30
 
34
- protected
31
+ private
35
32
  def set_attribute(name, value)
36
33
  if name and name != "objectClass"
37
34
  attribute_will_change!(name) unless value == get_attribute(name)
@@ -8,7 +8,7 @@ module ActiveLdap
8
8
  attribute_method_suffix '?'
9
9
  end
10
10
 
11
- protected
11
+ private
12
12
  def get_attribute_as_query(name, force_array=false)
13
13
  name, value = get_attribute_before_type_cast(name, force_array)
14
14
  if force_array
@@ -3,11 +3,15 @@ module ActiveLdap
3
3
  module Read
4
4
  extend ActiveSupport::Concern
5
5
 
6
- protected
6
+ private
7
7
  def attribute(attr, *args)
8
8
  return get_attribute(attr, args.first)
9
9
  end
10
10
 
11
+ def _read_attribute(name)
12
+ get_attribute(name)
13
+ end
14
+
11
15
  # get_attribute
12
16
  #
13
17
  # Return the value of the attribute called by method_missing?
@@ -7,7 +7,7 @@ module ActiveLdap
7
7
  attribute_method_suffix '='
8
8
  end
9
9
 
10
- protected
10
+ private
11
11
  def attribute=(attr, *args)
12
12
  return set_attribute(attr, args.first)
13
13
  end
@@ -946,9 +946,7 @@ module ActiveLdap
946
946
  def clear_object_class_based_cache
947
947
  @entry_attribute = nil
948
948
  @real_names = {}
949
- @changed_attributes.reject! do |key, _|
950
- not attribute_method?(key)
951
- end
949
+ clear_changes_information
952
950
  end
953
951
 
954
952
  def clear_removed_attributes_data(removed_attributes)
@@ -1117,7 +1115,7 @@ module ActiveLdap
1117
1115
  end
1118
1116
  set_attribute(key, value)
1119
1117
  end
1120
- @changed_attributes.clear
1118
+ clear_changes_information
1121
1119
  end
1122
1120
  private :initialize_attributes
1123
1121
 
@@ -1167,8 +1165,6 @@ module ActiveLdap
1167
1165
  @dn_split_value = nil
1168
1166
  @connection ||= nil
1169
1167
  @_hashing = false
1170
- @previously_changed = []
1171
- @changed_attributes = {}
1172
1168
  clear_connection_based_cache
1173
1169
  end
1174
1170
 
@@ -1,9 +1,11 @@
1
1
  module ActiveLdap
2
2
  module Populate
3
3
  module_function
4
- def ensure_base(base_class=nil)
4
+ def ensure_base(base_class=nil, options={})
5
5
  base_class ||= Base
6
6
  return unless base_class.search(:scope => :base).empty?
7
+ dc_base_class = options[:dc_base_class] || base_class
8
+ ou_base_class = options[:ou_base_class] || base_class
7
9
 
8
10
  base_dn = DN.parse(base_class.base)
9
11
  suffixes = []
@@ -15,11 +17,11 @@ module ActiveLdap
15
17
  begin
16
18
  case name.downcase
17
19
  when "dc"
18
- ensure_dc(value, prefix, base_class)
20
+ ensure_dc(value, prefix, dc_base_class)
19
21
  when "ou"
20
22
  ensure_ou(value,
21
23
  :base => prefix,
22
- :base_class => base_class)
24
+ :base_class => ou_base_class)
23
25
  end
24
26
  rescue ActiveLdap::OperationNotPermitted
25
27
  end
@@ -6,8 +6,7 @@ module ActiveLdap
6
6
  module ControllerRuntime #:nodoc:
7
7
  extend ActiveSupport::Concern
8
8
 
9
- protected
10
-
9
+ private
11
10
  attr_internal :ldap_runtime
12
11
 
13
12
  def process_action(action, *args)
@@ -1,3 +1,3 @@
1
1
  module ActiveLdap
2
- VERSION = "5.1.1"
2
+ VERSION = "5.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activeldap
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.1
4
+ version: 5.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Will Drewry
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-01-16 00:00:00.000000000 Z
12
+ date: 2018-05-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activemodel
@@ -359,7 +359,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
359
359
  version: '0'
360
360
  requirements: []
361
361
  rubyforge_project: ruby-activeldap
362
- rubygems_version: 2.5.2.2
362
+ rubygems_version: 2.7.6
363
363
  signing_key:
364
364
  specification_version: 4
365
365
  summary: ActiveLdap is a object-oriented API to LDAP