ruby-activeldap 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/activeldap.rb +1 -1
  2. data/lib/activeldap/base.rb +48 -42
  3. metadata +2 -2
data/lib/activeldap.rb CHANGED
@@ -880,7 +880,7 @@ require 'activeldap/configuration'
880
880
  require 'activeldap/schema2'
881
881
 
882
882
  module ActiveLDAP
883
- VERSION = "0.4.2"
883
+ VERSION = "0.4.3"
884
884
  end
885
885
 
886
886
  ActiveLDAP::Base.class_eval do
@@ -689,54 +689,56 @@ module ActiveLDAP
689
689
  # Put all changes into one change entry to ensure
690
690
  # automatic rollback upon failure.
691
691
  entry = []
692
- if @exists
693
- # Cycle through all attrs to determine action
694
- action = {}
695
692
 
696
- replaceable = []
697
693
 
698
- # Expand subtypes to real ldap_data entries
699
- # We can't reuse @ldap_data because an exception would leave
700
- # an object in an unknown state
701
- @@logger.debug("#write: dup'ing @ldap_data")
702
- ldap_data = @ldap_data.dup
703
- @@logger.debug("#write: dup finished @ldap_data")
704
- @@logger.debug("#write: expanding subtypes in @ldap_data")
705
- ldap_data.keys.each do |key|
706
- ldap_data[key].each do |value|
707
- if value.class == Hash
708
- suffix, real_value = extract_subtypes(value)
709
- if ldap_data.has_key? key + suffix
710
- ldap_data[key + suffix].push(real_value)
711
- else
712
- ldap_data[key + suffix] = real_value
713
- end
714
- ldap_data[key].delete(value)
694
+ # Expand subtypes to real ldap_data entries
695
+ # We can't reuse @ldap_data because an exception would leave
696
+ # an object in an unknown state
697
+ @@logger.debug("#write: dup'ing @ldap_data")
698
+ ldap_data = @ldap_data.dup
699
+ @@logger.debug("#write: dup finished @ldap_data")
700
+ @@logger.debug("#write: expanding subtypes in @ldap_data")
701
+ ldap_data.keys.each do |key|
702
+ ldap_data[key].each do |value|
703
+ if value.class == Hash
704
+ suffix, real_value = extract_subtypes(value)
705
+ if ldap_data.has_key? key + suffix
706
+ ldap_data[key + suffix].push(real_value)
707
+ else
708
+ ldap_data[key + suffix] = real_value
715
709
  end
710
+ ldap_data[key].delete(value)
716
711
  end
717
712
  end
718
- @@logger.debug("#write: subtypes expanded for @ldap_data")
719
-
720
- # Expand subtypes to real data entries, but leave @data alone
721
- @@logger.debug("#write: dup'ing @data")
722
- data = @data.dup
723
- @@logger.debug("#write: finished dup'ing @data")
724
- @@logger.debug("#write: expanding subtypes for @data")
725
- data.keys.each do |key|
726
- data[key].each do |value|
727
- if value.class == Hash
728
- suffix, real_value = extract_subtypes(value)
729
- if data.has_key? key + suffix
730
- data[key + suffix].push(real_value)
731
- else
732
- data[key + suffix] = real_value
733
- end
734
- data[key].delete(value)
713
+ end
714
+ @@logger.debug("#write: subtypes expanded for @ldap_data")
715
+
716
+ # Expand subtypes to real data entries, but leave @data alone
717
+ @@logger.debug("#write: dup'ing @data")
718
+ data = @data.dup
719
+ @@logger.debug("#write: finished dup'ing @data")
720
+ @@logger.debug("#write: expanding subtypes for @data")
721
+ data.keys.each do |key|
722
+ data[key].each do |value|
723
+ if value.class == Hash
724
+ suffix, real_value = extract_subtypes(value)
725
+ if data.has_key? key + suffix
726
+ data[key + suffix].push(real_value)
727
+ else
728
+ data[key + suffix] = real_value
735
729
  end
730
+ data[key].delete(value)
736
731
  end
737
732
  end
738
- @@logger.debug("#write: subtypes expanded for @data")
733
+ end
734
+ @@logger.debug("#write: subtypes expanded for @data")
735
+
739
736
 
737
+ if @exists
738
+ # Cycle through all attrs to determine action
739
+ action = {}
740
+
741
+ replaceable = []
740
742
  # Now that all the subtypes will be treated as unique attributes
741
743
  # we can see what's changed and add anything that is brand-spankin'
742
744
  # new.
@@ -805,11 +807,15 @@ module ActiveLDAP
805
807
  @@logger.debug("#write: adding objectClass = #{data[@attr_methods['objectClass']].inspect}")
806
808
  entry.push(LDAP.mod(LDAP::LDAP_MOD_ADD, 'objectClass',
807
809
  data[@attr_methods['objectClass']]))
808
- @data.each do |pair|
810
+ data.each do |pair|
809
811
  if pair[1].size > 0 and pair[0] != 'objectClass' and pair[0] != @attr_methods[dnattr()]
810
812
  # Detect subtypes and account for them
811
- binary = LDAP::LDAP_MOD_BVALUES if pair[0].match(/;binary(;|$)/)
812
- @@logger.debug("adding attribute to new entry: #{name+suffix}: #{value.inspect}")
813
+ if pair[0].match(/;binary(;|$)/)
814
+ binary = LDAP::LDAP_MOD_BVALUES
815
+ else
816
+ binary = 0
817
+ end
818
+ @@logger.debug("adding attribute to new entry: #{pair[0].inspect}: #{pair[1].inspect}")
813
819
  entry.push(LDAP.mod(LDAP::LDAP_MOD_ADD|binary, pair[0], pair[1]))
814
820
  end
815
821
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.1
3
3
  specification_version: 1
4
4
  name: ruby-activeldap
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.4.2
7
- date: 2004-10-07
6
+ version: 0.4.3
7
+ date: 2004-10-08
8
8
  summary: Ruby/ActiveLDAP is a object-oriented API to LDAP
9
9
  require_paths:
10
10
  - lib