acs-ldap 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 50675f7d1bbd75b59901e4170def20da22e096d2
4
- data.tar.gz: f48b43f7b735fcb00f16d8291f705a1eef145aa7
3
+ metadata.gz: 4ac45707d304faeaa2a67eaacf945d13aeeff317
4
+ data.tar.gz: 72615c12fb0b23404500819541eac7d9d3f21ccd
5
5
  SHA512:
6
- metadata.gz: 341a560f4fdb610453c4bfcbb6b115d9bda785f3c2148e13c88cc23c6db2d122b9be3336f1f751ccc56e427798fe19bff93da3fe0ec648fd906966b791425e53
7
- data.tar.gz: 90418e33192d9d2fa9044f7594d59e81c9968a2bee13a26655a19b4347004f7de3330fe93efb741569e5e9c690a7c370927bdff26e0568016f2433f51c8ab934
6
+ metadata.gz: d829a90c37601abab9f1c7d26ad53baadca96b89cc60bd53437add329af2a699dbcd901d5ddbb1f6487725b45f58a87eeacab3c500313086ae0d991ac0905933
7
+ data.tar.gz: 6117567fb46a06c73a049ad390f2fe8e79841716d20b3228fe5d525ba8b3111ee38f5a2c73317fab970210d2ef80024afef46511b28d54f0d0b3b77d6e042d0c
@@ -15,7 +15,7 @@ class Acs::Ldap::Mapper
15
15
  @ou = ou
16
16
  @method_separator = options[:method_separator] || '.'
17
17
  @force_method_calls = options[:force_method_calls] || false
18
- Acs::Ldap::logger.error "Acs::Ldap::Mapper with options methods_separator '#{@method_separator}' force_method_calls '#{@force_method_calls}'"
18
+ Acs::Ldap::logger.debug "Acs::Ldap::Mapper with options methods_separator '#{@method_separator}' force_method_calls '#{@force_method_calls}'"
19
19
  end
20
20
 
21
21
  # Populate a hash based on the provided mapping and object
@@ -11,7 +11,7 @@ class Acs::Ldap::Pusher
11
11
  @mapper = mapper
12
12
  end
13
13
 
14
- def save(model)
14
+ def save(model, options = {})
15
15
  if exist?(model)
16
16
  update(model)
17
17
  else
@@ -19,7 +19,7 @@ class Acs::Ldap::Pusher
19
19
  end
20
20
  end
21
21
 
22
- def create(model)
22
+ def create(model, options = {})
23
23
  attributes = @mapper.attributes(model).except!(:uid)
24
24
  attributes.merge!(objectClass: @mapper.object_class)
25
25
 
@@ -31,11 +31,18 @@ class Acs::Ldap::Pusher
31
31
  )
32
32
  end
33
33
 
34
- def update(model, attributes = nil)
34
+ def update(model, options = {})
35
+ changes = options.fetch(:changes, nil)
35
36
  attributes = @mapper.attributes(model).except(:uid)
36
37
  operations = []
37
38
  attributes.each do |key, value|
38
- operations << [:replace, key.to_s, value] if attributes.nil? or attributes.include?(key)
39
+ if attributes.nil? or attributes.include?(key)
40
+ if changes.nil?
41
+ operations << [:replace, key.to_s, value]
42
+ else
43
+ operations << [:replace, key.to_s, value] if changes.has_key?(key)
44
+ end
45
+ end
39
46
  end
40
47
 
41
48
  @connector.update(
@@ -44,7 +51,7 @@ class Acs::Ldap::Pusher
44
51
  )
45
52
  end
46
53
 
47
- def destroy(model)
54
+ def destroy(model, options = {})
48
55
  @connector.delete(dn(model))
49
56
  end
50
57
 
@@ -1,5 +1,5 @@
1
1
  module Acs
2
2
  module Ldap
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end