ruby-activeldap 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -34,7 +34,7 @@ require 'ldap/schema'
34
34
  require 'log4r'
35
35
 
36
36
  module ActiveLDAP
37
- # OO-interface to LDAP assuming pam/nss_ldap-style organization with Active specifics
37
+ # OO-interface to LDAP assuming pam/nss_ldap-style comanization with Active specifics
38
38
  # Each subclass does a ldapsearch for the matching entry.
39
39
  # If no exact match, raise an error.
40
40
  # If match, change all LDAP attributes in accessor attributes on the object.
@@ -167,7 +167,7 @@ module ActiveLDAP
167
167
  # +config+ must be a hash that may contain any of the following fields:
168
168
  # :user, :password_block, :logger, :host, :port, :base, :bind_format, :try_sasl, :allow_anonymous
169
169
  # :user specifies the username to bind with.
170
- # :bind_format specifies the string to substitute the username into on bind. e.g. uid=%s,ou=People,dc=dataspill,dc=org. Overrides @@bind_format.
170
+ # :bind_format specifies the string to substitute the username into on bind. e.g. uid=%s,ou=People,dc=example,dc=com. Overrides @@bind_format.
171
171
  # :password_block specifies a Proc object that will yield a String to be used as the password when called.
172
172
  # :logger specifies a preconfigured Log4r::Logger to be used for all logging
173
173
  # :host overrides the configuration.rb @@host setting with the LDAP server hostname
@@ -231,7 +231,7 @@ module ActiveLDAP
231
231
  @@conn = LDAP::Conn.new(@@config[:host], @@config[:port])
232
232
  end
233
233
  end
234
- @@logger.debug "Connected to #{@@config[:host]}:#{@@config[:port]}."
234
+
235
235
 
236
236
  # Enforce LDAPv3
237
237
  @@conn.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3)
@@ -308,7 +308,7 @@ module ActiveLDAP
308
308
  values.push(res)
309
309
  end
310
310
  rescue RuntimeError => detail
311
- @@logger.debug "No matches for #{config[:filter]} and attrs #{config[:attrs]}"
311
+
312
312
  # Do nothing on failure
313
313
  end
314
314
  return values
@@ -364,7 +364,7 @@ module ActiveLDAP
364
364
  end
365
365
  end
366
366
  rescue RuntimeError => detail
367
- @@logger.debug "No matches for #{attr}=#{val}"
367
+
368
368
  # Do nothing on failure
369
369
  end
370
370
  return nil
@@ -417,7 +417,7 @@ module ActiveLDAP
417
417
  end
418
418
  rescue RuntimeError => detail
419
419
  #p @@conn.err2string(@@conn.err)
420
- @@logger.debug "No matches for #{attr}=#{val}"
420
+
421
421
  # Do nothing on failure
422
422
  end
423
423
  return matches
@@ -488,7 +488,7 @@ module ActiveLDAP
488
488
  if val.class == LDAP::Entry
489
489
  # Call import, which is basically initialize
490
490
  # without accessing LDAP.
491
- @@logger.debug "initialize: val is a LDAP::Entry - running import."
491
+
492
492
  import(val)
493
493
  return
494
494
  end
@@ -524,12 +524,12 @@ module ActiveLDAP
524
524
  # Save DN
525
525
  @dn = m.dn
526
526
  # Load up data into tmp
527
- @@logger.debug("loading entry: #{@dn}")
527
+
528
528
  m.attrs.each do |attr|
529
529
  # Load with subtypes just like @data
530
- @@logger.debug("calling make_subtypes for m.vals(attr).dup")
530
+
531
531
  safe_attr, value = make_subtypes(attr, m.vals(attr).dup)
532
- @@logger.debug("finished make_subtypes for #{attr}")
532
+
533
533
  # Add subtype to any existing values
534
534
  if @ldap_data.has_key? safe_attr
535
535
  value.each do |v|
@@ -557,7 +557,7 @@ module ActiveLDAP
557
557
 
558
558
  # Setup dn attribute (later rdn too!)
559
559
  attr_sym = "#{dnattr()}=".to_sym
560
- @@logger.debug("new: setting dnattr: #{dnattr()} = #{val}")
560
+
561
561
  send(attr_sym, val)
562
562
  end
563
563
  end
@@ -571,7 +571,7 @@ module ActiveLDAP
571
571
  # Return attribute methods so that a program can determine available
572
572
  # attributes dynamically without schema awareness
573
573
  def attributes
574
- @@logger.debug("stub: attributes called")
574
+
575
575
  send(:apply_objectclass, @data['objectClass']) if @data['objectClass'] != @last_oc
576
576
  return @attr_methods.keys
577
577
  end
@@ -580,7 +580,7 @@ module ActiveLDAP
580
580
  #
581
581
  # Return whether the entry exists in LDAP or not
582
582
  def exists?
583
- @@logger.debug("stub: exists? called")
583
+
584
584
  return @exists
585
585
  end
586
586
 
@@ -588,7 +588,7 @@ module ActiveLDAP
588
588
  #
589
589
  # Return the authoritative dn
590
590
  def dn
591
- @@logger.debug("stub: dn called")
591
+
592
592
  return @dn.dup
593
593
  end
594
594
 
@@ -599,7 +599,7 @@ module ActiveLDAP
599
599
  # - Enforcement of undefined attributes is handled in the objectClass= method
600
600
  # Must call enforce_types() first before enforcement can be guaranteed
601
601
  def validate
602
- @@logger.debug("stub: validate called")
602
+
603
603
  # Clean up attr values, etc
604
604
  send(:enforce_types)
605
605
 
@@ -630,7 +630,7 @@ module ActiveLDAP
630
630
  end
631
631
  end
632
632
  end
633
- @@logger.debug("stub: validate finished")
633
+
634
634
  end
635
635
 
636
636
 
@@ -638,7 +638,7 @@ module ActiveLDAP
638
638
  #
639
639
  # Delete this entry from LDAP
640
640
  def delete
641
- @@logger.debug("stub: delete called")
641
+
642
642
  begin
643
643
  @@conn.delete(@dn)
644
644
  @exists = false
@@ -655,7 +655,7 @@ module ActiveLDAP
655
655
  # TODO: Binary data support
656
656
  # TODO: Relative DN support
657
657
  def write
658
- @@logger.debug("stub: write called")
658
+
659
659
  # Validate against the objectClass requirements
660
660
  validate
661
661
 
@@ -667,10 +667,10 @@ module ActiveLDAP
667
667
  # Expand subtypes to real ldap_data entries
668
668
  # We can't reuse @ldap_data because an exception would leave
669
669
  # an object in an unknown state
670
- @@logger.debug("#write: dup'ing @ldap_data")
670
+
671
671
  ldap_data = @ldap_data.dup
672
- @@logger.debug("#write: dup finished @ldap_data")
673
- @@logger.debug("#write: expanding subtypes in @ldap_data")
672
+
673
+
674
674
  ldap_data.keys.each do |key|
675
675
  ldap_data[key].each do |value|
676
676
  if value.class == Hash
@@ -684,13 +684,13 @@ module ActiveLDAP
684
684
  end
685
685
  end
686
686
  end
687
- @@logger.debug("#write: subtypes expanded for @ldap_data")
687
+
688
688
 
689
689
  # Expand subtypes to real data entries, but leave @data alone
690
- @@logger.debug("#write: dup'ing @data")
690
+
691
691
  data = @data.dup
692
- @@logger.debug("#write: finished dup'ing @data")
693
- @@logger.debug("#write: expanding subtypes for @data")
692
+
693
+
694
694
  data.keys.each do |key|
695
695
  data[key].each do |value|
696
696
  if value.class == Hash
@@ -704,7 +704,7 @@ module ActiveLDAP
704
704
  end
705
705
  end
706
706
  end
707
- @@logger.debug("#write: subtypes expanded for @data")
707
+
708
708
 
709
709
 
710
710
  if @exists
@@ -715,7 +715,7 @@ module ActiveLDAP
715
715
  # Now that all the subtypes will be treated as unique attributes
716
716
  # we can see what's changed and add anything that is brand-spankin'
717
717
  # new.
718
- @@logger.debug("#write: traversing ldap_data determining replaces and deletes")
718
+
719
719
  ldap_data.each do |pair|
720
720
  suffix = ''
721
721
  binary = 0
@@ -735,18 +735,18 @@ module ActiveLDAP
735
735
  if not value.empty?
736
736
  # Ditched delete then replace because attribs with no equality match rules
737
737
  # will fails
738
- @@logger.debug("updating attribute of existing entry: #{name+suffix}: #{value.inspect}")
738
+
739
739
  entry.push(LDAP.mod(LDAP::LDAP_MOD_REPLACE|binary, name + suffix, value))
740
740
  else
741
741
  # Since some types do not have equality matching rules, delete doesn't work
742
742
  # Replacing with nothing is equivalent.
743
- @@logger.debug("removing attribute from existing entry: #{name+suffix}")
743
+
744
744
  entry.push(LDAP.mod(LDAP::LDAP_MOD_REPLACE|binary, name + suffix, []))
745
745
  end
746
746
  end
747
747
  end
748
- @@logger.debug("#write: finished traversing ldap_data")
749
- @@logger.debug("#write: traversing data determining adds")
748
+
749
+
750
750
  data.each do |pair|
751
751
  suffix = ''
752
752
  binary = 0
@@ -760,26 +760,26 @@ module ActiveLDAP
760
760
  if not replaceable.member? name+suffix
761
761
  # Detect subtypes and account for them
762
762
  binary = LDAP::LDAP_MOD_BVALUES if Base.schema.binary? name
763
- @@logger.debug("adding attribute to existing entry: #{name+suffix}: #{value.inspect}")
763
+
764
764
  # REPLACE will function like ADD, but doesn't hit EQUALITY problems
765
765
  # TODO: Added equality(attr) to Schema2
766
766
  entry.push(LDAP.mod(LDAP::LDAP_MOD_REPLACE|binary, name + suffix, value)) unless value.empty?
767
767
  end
768
768
  end
769
- @@logger.debug("#write: traversing data complete")
769
+
770
770
  begin
771
- @@logger.debug("#write: modifying #{@dn}")
771
+
772
772
  @@conn.modify(@dn, entry)
773
- @@logger.debug("#write: modify successful")
773
+
774
774
  rescue => detail
775
775
  raise WriteError, "Could not update LDAP entry: #{detail}"
776
776
  end
777
777
  else # add everything!
778
- @@logger.debug("#write: adding all attribute value pairs")
779
- @@logger.debug("#write: adding #{@attr_methods[dnattr()].inspect} = #{data[@attr_methods[dnattr()]].inspect}")
778
+
779
+
780
780
  entry.push(LDAP.mod(LDAP::LDAP_MOD_ADD, @attr_methods[dnattr()],
781
781
  data[@attr_methods[dnattr()]]))
782
- @@logger.debug("#write: adding objectClass = #{data[@attr_methods['objectClass']].inspect}")
782
+
783
783
  entry.push(LDAP.mod(LDAP::LDAP_MOD_ADD, 'objectClass',
784
784
  data[@attr_methods['objectClass']]))
785
785
  data.each do |pair|
@@ -790,23 +790,23 @@ module ActiveLDAP
790
790
  else
791
791
  binary = 0
792
792
  end
793
- @@logger.debug("adding attribute to new entry: #{pair[0].inspect}: #{pair[1].inspect}")
793
+
794
794
  entry.push(LDAP.mod(LDAP::LDAP_MOD_ADD|binary, pair[0], pair[1]))
795
795
  end
796
796
  end
797
797
  begin
798
- @@logger.debug("#write: adding #{@dn}")
798
+
799
799
  @@conn.add(@dn, entry)
800
- @@logger.debug("#write: add successful")
800
+
801
801
  @exists = true
802
802
  rescue LDAP::ResultError => detail
803
803
  raise WriteError, "Could not add LDAP entry[#{Base.connection.err2string(Base.connection.err)}]: #{detail}"
804
804
  end
805
805
  end
806
- @@logger.debug("#write: resetting @ldap_data to a dup of @data")
806
+
807
807
  @ldap_data = @data.dup
808
- @@logger.debug("#write: @ldap_data reset complete")
809
- @@logger.debug("stub: write exitted")
808
+
809
+
810
810
  end
811
811
 
812
812
 
@@ -818,26 +818,26 @@ module ActiveLDAP
818
818
  # using class_eval instead of using method_missing. This would
819
819
  # give tab completion in irb.
820
820
  def method_missing(name, *args)
821
- @@logger.debug("stub: called method_missing(#{name.inspect}, #{args.inspect})")
821
+
822
822
 
823
823
  # dynamically update the available attributes without requiring an
824
824
  # explicit call. The cache 'last_oc' saves a lot of cpu time.
825
825
  if @data['objectClass'] != @last_oc
826
- @@logger.debug("method_missing(#{name.inspect}, #{args.inspect}): updating apply_objectclass(#{@data['objectClass'].inspect})")
826
+
827
827
  send(:apply_objectclass, @data['objectClass'])
828
828
  end
829
829
  key = name.to_s
830
830
  case key
831
831
  when /^(\S+)=$/
832
832
  real_key = $1
833
- @@logger.debug("method_missing: attr_methods has_key? #{real_key}")
833
+
834
834
  if @attr_methods.has_key? real_key
835
835
  raise ArgumentError, "wrong number of arguments (#{args.size} for 1)" if args.size != 1
836
- @@logger.debug("method_missing: calling :attribute_method=(#{real_key}, #{args[0]})")
836
+
837
837
  return send(:attribute_method=, real_key, args[0])
838
838
  end
839
839
  else
840
- @@logger.debug("method_missing: attr_methods has_key? #{key}")
840
+
841
841
  if @attr_methods.has_key? key
842
842
  raise ArgumentError, "wrong number of arguments (#{args.size} for 1)" if args.size > 1
843
843
  return attribute_method(key, *args)
@@ -861,7 +861,7 @@ module ActiveLDAP
861
861
  # with the data given in the data given in LDAP::Entry.
862
862
  #
863
863
  def import(entry=nil)
864
- @@logger.debug("stub: import called")
864
+
865
865
  if entry.class != LDAP::Entry
866
866
  raise TypeError, "argument must be a LDAP::Entry"
867
867
  end
@@ -876,9 +876,9 @@ module ActiveLDAP
876
876
  @dn = entry.dn
877
877
  entry.attrs.each do |attr|
878
878
  # Load with subtypes just like @data
879
- @@logger.debug("calling make_subtypes for entry.vals(attr).dup")
879
+
880
880
  safe_attr, value = make_subtypes(attr, entry.vals(attr).dup)
881
- @@logger.debug("finished make_subtypes for #{attr}")
881
+
882
882
  # Add subtype to any existing values
883
883
  if @ldap_data.has_key? safe_attr
884
884
  value.each do |v|
@@ -904,13 +904,13 @@ module ActiveLDAP
904
904
  # enforce_types applies your changes without attempting to write to LDAP. This means that
905
905
  # if you set userCertificate to somebinary value, it will wrap it up correctly.
906
906
  def enforce_types
907
- @@logger.debug("stub: enforce_types called")
907
+
908
908
  send(:apply_objectclass, @data['objectClass']) if @data['objectClass'] != @last_oc
909
909
  # Enforce attribute value formatting
910
910
  @data.keys.each do |key|
911
911
  @data[key] = attribute_input_handler(key, @data[key])
912
912
  end
913
- @@logger.debug("stub: enforce_types done")
913
+
914
914
  return true
915
915
  end
916
916
 
@@ -922,7 +922,7 @@ module ActiveLDAP
922
922
  # removing defined attributes that are no longer valid
923
923
  # given the new objectclasses.
924
924
  def apply_objectclass(val)
925
- @@logger.debug("stub: objectClass=(#{val.inspect}) called")
925
+
926
926
  new_oc = val
927
927
  new_oc = [val] if new_oc.class != Array
928
928
  return new_oc if @last_oc == new_oc
@@ -967,7 +967,7 @@ module ActiveLDAP
967
967
  # Hashes are for subtypes
968
968
  # Arrays are for multiple entries
969
969
  def attribute_input_handler(attr, value)
970
- @@logger.debug("stub: called attribute_input_handler(#{attr.inspect}, #{value.inspect})")
970
+
971
971
  if attr.nil?
972
972
  raise RuntimeError, 'The first argument, attr, must not be nil. Please report this as a bug!'
973
973
  end
@@ -980,7 +980,7 @@ module ActiveLDAP
980
980
  end
981
981
  value.map! do |entry|
982
982
  if entry.class != Hash
983
- @@logger.debug("coercing value for #{attr} into a string because nested values exceeds a useful depth: #{entry.inspect} -> #{entry.to_s}")
983
+
984
984
  entry = entry.to_s
985
985
  end
986
986
  entry = attribute_input_handler(attr, entry)[0]
@@ -1015,7 +1015,7 @@ module ActiveLDAP
1015
1015
  # e.g. userCertificate;binary => "some_bin"
1016
1016
  # becomes userCertificate => {"binary" => "some_bin"}
1017
1017
  def make_subtypes(attr, value)
1018
- @@logger.debug("stub: called make_subtypes(#{attr.inspect}, #{value.inspect})")
1018
+
1019
1019
  return [attr, value] unless attr.match(/;/)
1020
1020
 
1021
1021
  ret_attr, *subtypes = attr.split(/;/)
@@ -1027,7 +1027,7 @@ module ActiveLDAP
1027
1027
  # This is a recursive function for building
1028
1028
  # nested hashed from multi-subtyped values
1029
1029
  def make_subtypes_helper(subtypes, value)
1030
- @@logger.debug("stub: called make_subtypes_helper(#{subtypes.inspect}, #{value.inspect})")
1030
+
1031
1031
  return value if subtypes.size == 0
1032
1032
  return {subtypes[0] => make_subtypes_helper(subtypes[1..-1], value)}
1033
1033
  end
@@ -1037,7 +1037,7 @@ module ActiveLDAP
1037
1037
  # Extracts all of the subtypes from a given set of nested hashes
1038
1038
  # and returns the attribute suffix and the final true value
1039
1039
  def extract_subtypes(value)
1040
- @@logger.debug("stub: called extract_subtypes(#{value.inspect})")
1040
+
1041
1041
  subtype = ''
1042
1042
  ret_val = value
1043
1043
  if value.class == Hash
@@ -1087,7 +1087,7 @@ module ActiveLDAP
1087
1087
  @@conn.bind()
1088
1088
  return true
1089
1089
  rescue
1090
- @@logger.debug "LDAP Error: #{@@conn.err2string(@@conn.err)}"
1090
+
1091
1091
  @@logger.warn "Warning: Anonymous authentication failed."
1092
1092
  return false
1093
1093
  end
@@ -1102,7 +1102,7 @@ module ActiveLDAP
1102
1102
  @@conn.bind(bind_dn, @@config[:password_block].call())
1103
1103
  return true
1104
1104
  rescue
1105
- @@logger.debug "LDAP Error: #{@@conn.err2string(@@conn.err)}"
1105
+
1106
1106
  @@logger.warn "Warning: SIMPLE authentication failed."
1107
1107
  return false
1108
1108
  end
@@ -1116,14 +1116,14 @@ module ActiveLDAP
1116
1116
  mechanisms = @@conn.root_dse[0]['supportedSASLMechanisms']
1117
1117
  # Use GSSAPI if available
1118
1118
  # Currently only GSSAPI is supported with Ruby/LDAP from
1119
- # http://caliban.org/files/redhat/RPMS/i386/ruby-ldap-0.8.2-4.i386.rpm
1119
+ # http://caliban.com/files/redhat/RPMS/i386/ruby-ldap-0.8.2-4.i386.rpm
1120
1120
  # TODO: Investigate further SASL support
1121
1121
  if mechanisms.respond_to? :member? and mechanisms.member? 'GSSAPI'
1122
1122
  begin
1123
1123
  @@conn.sasl_bind(bind_dn, 'GSSAPI')
1124
1124
  return true
1125
1125
  rescue
1126
- @@logger.debug "LDAP Error: #{@@conn.err2string(@@conn.err)}"
1126
+
1127
1127
  @@logger.warn "Warning: SASL GSSAPI authentication failed."
1128
1128
  return false
1129
1129
  end
@@ -1136,7 +1136,7 @@ module ActiveLDAP
1136
1136
  # Returns the value of self.class.base
1137
1137
  # This is just syntactic sugar
1138
1138
  def base
1139
- @@logger.debug("stub: called base")
1139
+
1140
1140
  self.class.base
1141
1141
  end
1142
1142
 
@@ -1145,7 +1145,7 @@ module ActiveLDAP
1145
1145
  # Returns the value of self.class.required_classes
1146
1146
  # This is just syntactic sugar
1147
1147
  def required_classes
1148
- @@logger.debug("stub: called required_classes")
1148
+
1149
1149
  self.class.required_classes
1150
1150
  end
1151
1151
 
@@ -1154,7 +1154,7 @@ module ActiveLDAP
1154
1154
  # Returns the value of self.class.dnattr
1155
1155
  # This is just syntactic sugar
1156
1156
  def dnattr
1157
- @@logger.debug("stub: called dnattr")
1157
+
1158
1158
  self.class.dnattr
1159
1159
  end
1160
1160
 
@@ -1162,7 +1162,7 @@ module ActiveLDAP
1162
1162
  #
1163
1163
  # Return the value of the attribute called by method_missing?
1164
1164
  def attribute_method(method, not_array = false)
1165
- @@logger.debug("stub: called attribute_method(#{method.inspect}, #{not_array.inspect}")
1165
+
1166
1166
  attr = @attr_methods[method]
1167
1167
 
1168
1168
  # Return a copy of the stored data
@@ -1175,16 +1175,16 @@ module ActiveLDAP
1175
1175
  #
1176
1176
  # Set the value of the attribute called by method_missing?
1177
1177
  def attribute_method=(method, value)
1178
- @@logger.debug("stub: called attribute_method=(#{method.inspect}, #{value.inspect})")
1178
+
1179
1179
  # Get the attr and clean up the input
1180
1180
  attr = @attr_methods[method]
1181
- @@logger.debug("attribute_method=(#{method.inspect}, #{value.inspect}): method maps to #{attr}")
1181
+
1182
1182
 
1183
1183
  # Assign the value
1184
1184
  @data[attr] = value
1185
1185
 
1186
1186
  # Return the passed in value
1187
- @@logger.debug("stub: exitting attribute_method=")
1187
+
1188
1188
  return @data[attr]
1189
1189
  end
1190
1190
 
@@ -1194,16 +1194,16 @@ module ActiveLDAP
1194
1194
  # Make a method entry for _every_ alias of a valid attribute and map it
1195
1195
  # onto the first attribute passed in.
1196
1196
  def define_attribute_methods(attr)
1197
- @@logger.debug("stub: called define_attribute_methods(#{attr.inspect})")
1197
+
1198
1198
  if @attr_methods.has_key? attr
1199
1199
  return
1200
1200
  end
1201
1201
  aliases = Base.schema.attribute_aliases(attr)
1202
1202
  aliases.each do |ali|
1203
- @@logger.debug("associating #{ali} --> #{attr}")
1203
+
1204
1204
  @attr_methods[ali] = attr
1205
1205
  end
1206
- @@logger.debug("stub: leaving define_attribute_methods(#{attr.inspect})")
1206
+
1207
1207
  end
1208
1208
 
1209
1209
  # array_of
@@ -1211,7 +1211,7 @@ module ActiveLDAP
1211
1211
  # Returns the array form of a value, or not an array if
1212
1212
  # false is passed in.
1213
1213
  def array_of(value, to_a = true)
1214
- @@logger.debug("stub: called array_of(#{value.inspect}, #{to_a.inspect})")
1214
+
1215
1215
  if to_a
1216
1216
  case value.class.to_s
1217
1217
  when 'Array'
@@ -6,13 +6,13 @@ module ActiveLDAP
6
6
  # ActiveLDAP to work with your LDAP server. All of these
7
7
  # settings can be passed in at initialization time.
8
8
  module Configuration
9
- @@host = "localhost"
9
+ @@host = "127.0.0.1"
10
10
  @@port = 389
11
- @@bind_format = "uid=%s,ou=People,dc=dataspill,dc=org"
11
+ @@bind_format = "uid=%s,ou=People,dc=example,dc=com"
12
12
 
13
13
  # Make the return value the string that is your LDAP base
14
14
  def Base.base
15
- 'dc=dataspill,dc=org'
15
+ 'dc=example,dc=com'
16
16
  end
17
17
 
18
18
  # This is optionally set to the array of objectClass names
data/lib/activeldap.rb CHANGED
@@ -8,7 +8,7 @@
8
8
  # Ruby/ActiveLDAP is a novel way of interacting with LDAP. Most interaction with
9
9
  # LDAP is done using clunky LDIFs, web interfaces, or with painful APIs that
10
10
  # required a thick reference manual nearby. Ruby/ActiveLDAP aims to fix that.
11
- # Inspired by ActiveRecord[http://activerecord.rubyonrails.org], Ruby/ActiveLDAP provides an
11
+ # Inspired by ActiveRecord[http://activerecord.rubyonrails.com], Ruby/ActiveLDAP provides an
12
12
  # object oriented interface to LDAP entries.
13
13
  #
14
14
  # The target audience is system administrators and LDAP users everywhere that
@@ -26,8 +26,8 @@
26
26
  # against Microsoft's ActiveDirectory, despite what the name implies.)
27
27
  #
28
28
  # Further reading:
29
- # * RFC1777[http://www.faqs.org/rfcs/rfc1777.html] - Lightweight Directory Access Protocol
30
- # * OpenLDAP[http://www.openldap.org]
29
+ # * RFC1777[http://www.faqs.com/rfcs/rfc1777.html] - Lightweight Directory Access Protocol
30
+ # * OpenLDAP[http://www.openldap.com]
31
31
  #
32
32
  # === So why use Ruby/ActiveLDAP?
33
33
  #
@@ -50,18 +50,18 @@
50
50
  #
51
51
  # === Requirements
52
52
  #
53
- # * Ruby[http://www.ruby-lang.org] 1.8.x
54
- # * Ruby/LDAP[http://ruby-ldap.sourceforge.net]
55
- # * Log4r[http://log4r.sourceforge.net]
56
- # * (Optional) Ruby/LDAP+GSSAPI[http://caliban.org/files/redhat/RPMS/i386/ruby-ldap-0.8.2-4.i386.rpm]
57
- # * An LDAP server compatible with Ruby/LDAP: OpenLDAP[http://www.openldap.org], etc
53
+ # * Ruby[http://www.ruby-lang.com] 1.8.x
54
+ # * Ruby/LDAP[http://ruby-ldap.sourcefcome.net]
55
+ # * Log4r[http://log4r.sourcefcome.net]
56
+ # * (Optional) Ruby/LDAP+GSSAPI[http://caliban.com/files/redhat/RPMS/i386/ruby-ldap-0.8.2-4.i386.rpm]
57
+ # * An LDAP server compatible with Ruby/LDAP: OpenLDAP[http://www.openldap.com], etc
58
58
  # - Your LDAP server must allow root_dse queries to allow for schema queries
59
- # * Examples also require: Ruby/Password[http://raa.ruby-lang.org/project/ruby-password/]
59
+ # * Examples also require: Ruby/Password[http://raa.ruby-lang.com/project/ruby-password/]
60
60
  #
61
61
  # === Installation
62
62
  #
63
63
  # Assuming all the requirements are installed, you can install by grabbing the latest tgz file from
64
- # the download site[http://projects.dataspill.org/libraries/ruby/activeldap/download.html].
64
+ # the download site[http://projects.example.com/libraries/ruby/activeldap/download.html].
65
65
  #
66
66
  # The following steps will get the Ruby/ActiveLDAP installed in no time!
67
67
  #
@@ -183,23 +183,23 @@
183
183
  # As you can see, this method is used for defining how this class maps in to LDAP. Let's say that
184
184
  # my LDAP tree looks something like this:
185
185
  #
186
- # * dc=dataspill,dc=org
187
- # |- ou=People,dc=dataspill,dc=org
188
- # |+ ou=Groups,dc=dataspill,dc=org
186
+ # * dc=example,dc=com
187
+ # |- ou=People,dc=example,dc=com
188
+ # |+ ou=Groups,dc=example,dc=com
189
189
  # \
190
- # |- cn=develop,ou=Groups,dc=dataspill,dc=org
191
- # |- cn=root,ou=Groups,dc=dataspill,dc=org
190
+ # |- cn=develop,ou=Groups,dc=example,dc=com
191
+ # |- cn=root,ou=Groups,dc=example,dc=com
192
192
  # |- ...
193
193
  #
194
194
  # Under ou=People I store user objects, and under ou=Groups, I store group
195
195
  # objects. What |ldap_mapping| has done is mapped the class in to the LDAP tree
196
196
  # abstractly. With the given :dnattr and :prefix, it will only work for entries
197
- # under ou=Groups,dc=dataspill,dc=org using the primary attribute 'cn' as the
197
+ # under ou=Groups,dc=example,dc=com using the primary attribute 'cn' as the
198
198
  # beginning of the distinguished name.
199
199
  #
200
200
  # Just for clarity, here's how the arguments map out:
201
201
  #
202
- # cn=develop,ou=Groups,dc=dataspill,dc=org
202
+ # cn=develop,ou=Groups,dc=example,dc=com
203
203
  # ^^ ^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^
204
204
  # :dnattr | |
205
205
  # :prefix |
@@ -233,11 +233,11 @@
233
233
  # tying objects together across the LDAP tree. Often, user objects will be
234
234
  # members of, or belong_to, Group objects.
235
235
  #
236
- # * dc=dataspill,dc=org
237
- # |+ ou=People,dc=dataspill,dc=org
236
+ # * dc=example,dc=com
237
+ # |+ ou=People,dc=example,dc=com
238
238
  # \
239
- # |- uid=drewry,ou=People,dc=dataspill,dc=org
240
- # |- ou=Groups,dc=dataspill,dc=org
239
+ # |- uid=drewry,ou=People,dc=example,dc=com
240
+ # |- ou=Groups,dc=example,dc=com
241
241
  #
242
242
  #
243
243
  # In the above tree, one such example would be user 'drewry' who is a part of the
@@ -385,7 +385,7 @@
385
385
  #
386
386
  # irb> Base.search(:base => 'dc=example,dc=com', :filter => '(uid=roo*)',
387
387
  # :scope => LDAP::LDAP_SCOPE_SUBTREE, :attrs => ['uid', 'cn'])
388
- # => [{"dn"=>"uid=root,ou=People,dc=dataspill,dc=org","cn"=>["root"], "uidNumber"=>["0"]}]
388
+ # => [{"dn"=>"uid=root,ou=People,dc=example,dc=com","cn"=>["root"], "uidNumber"=>["0"]}]
389
389
  # You can specify the :filter, :base, :scope, and :attrs, but they all have defaults --
390
390
  # * :filter defaults to objectClass=* - usually this isn't what you want
391
391
  # * :base defaults to the base of the class this is executed from (as set in ldap_mapping)
@@ -443,10 +443,10 @@
443
443
  # won't need to call Base.connect. Here is a fully parameterized call:
444
444
  #
445
445
  # Base.connect(
446
- # :host => 'ldap.dataspill.org',
446
+ # :host => 'ldap.example.com',
447
447
  # :port => 389,
448
- # :base => 'dc=dataspill,dc=org',
449
- # :bind_format => "uid=%s,ou=People,dc=dataspill,dc=org",
448
+ # :base => 'dc=example,dc=com',
449
+ # :bind_format => "uid=%s,ou=People,dc=example,dc=com",
450
450
  # :logger => log4r_obj,
451
451
  # :user => 'drewry',
452
452
  # :password_block => Proc.new { 'password12345' },
@@ -907,7 +907,7 @@ require 'activeldap/configuration'
907
907
  require 'activeldap/schema2'
908
908
 
909
909
  module ActiveLDAP
910
- VERSION = "0.5.4"
910
+ VERSION = "0.5.5"
911
911
  end
912
912
 
913
913
  ActiveLDAP::Base.class_eval do
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.1
2
+ rubygems_version: 0.8.4
3
3
  specification_version: 1
4
4
  name: ruby-activeldap
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.5.4
7
- date: 2005-02-17
6
+ version: 0.5.5
7
+ date: 2005-02-20
8
8
  summary: Ruby/ActiveLDAP is a object-oriented API to LDAP
9
9
  require_paths:
10
10
  - lib
11
- author: Will Drewry
12
11
  email: will@alum.bu.edu
13
12
  homepage: http://projects.dataspill.org/libraries/ruby/activeldap/index.html
14
13
  rubyforge_project: ruby-activeldap
@@ -25,6 +24,8 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
25
24
  version: 0.0.0
26
25
  version:
27
26
  platform: ruby
27
+ authors:
28
+ - Will Drewry
28
29
  files:
29
30
  - lib/activeldap
30
31
  - lib/activeldap.rb