activeldap 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (186) hide show
  1. data/CHANGES +17 -0
  2. data/README +7 -1
  3. data/Rakefile +2 -1
  4. data/benchmark/bench-al.rb +3 -3
  5. data/examples/al-admin/app/helpers/users_helper.rb +1 -1
  6. data/examples/al-admin/config/environment.rb +4 -3
  7. data/examples/al-admin/config/initializers/gettext.rb +1 -0
  8. data/examples/al-admin/config/session_secret.txt +1 -1
  9. data/examples/al-admin/po/al-admin.pot +344 -0
  10. data/examples/al-admin/public/images/active-ldap.png +0 -0
  11. data/examples/al-admin/vendor/locale_rails/.gitignore +6 -0
  12. data/examples/al-admin/vendor/locale_rails/COPYING +56 -0
  13. data/examples/al-admin/vendor/locale_rails/ChangeLog +35 -0
  14. data/examples/al-admin/vendor/locale_rails/README.rdoc +62 -0
  15. data/examples/al-admin/vendor/locale_rails/Rakefile +73 -0
  16. data/examples/al-admin/vendor/locale_rails/lib/locale_rails.rb +18 -0
  17. data/examples/al-admin/vendor/locale_rails/lib/locale_rails/action_controller.rb +15 -0
  18. data/examples/al-admin/vendor/locale_rails/lib/locale_rails/action_controller/base.rb +82 -0
  19. data/examples/al-admin/vendor/locale_rails/lib/locale_rails/action_controller/caching.rb +51 -0
  20. data/examples/al-admin/vendor/locale_rails/lib/locale_rails/action_controller/test_process.rb +44 -0
  21. data/examples/al-admin/vendor/locale_rails/lib/locale_rails/action_view.rb +53 -0
  22. data/examples/al-admin/vendor/locale_rails/lib/locale_rails/i18n.rb +67 -0
  23. data/examples/al-admin/vendor/locale_rails/lib/locale_rails/version.rb +4 -0
  24. data/examples/al-admin/vendor/locale_rails/sample/README +22 -0
  25. data/examples/al-admin/vendor/locale_rails/sample/Rakefile +10 -0
  26. data/examples/al-admin/vendor/locale_rails/sample/app/controllers/application.rb +42 -0
  27. data/examples/al-admin/vendor/locale_rails/sample/app/controllers/samples_controller.rb +30 -0
  28. data/examples/al-admin/vendor/locale_rails/sample/app/helpers/application_helper.rb +3 -0
  29. data/examples/al-admin/vendor/locale_rails/sample/app/views/layouts/samples.html.erb +20 -0
  30. data/examples/al-admin/vendor/locale_rails/sample/app/views/samples/_part.html.erb +68 -0
  31. data/examples/al-admin/vendor/locale_rails/sample/app/views/samples/_part_nl.html.erb +2 -0
  32. data/examples/al-admin/vendor/locale_rails/sample/app/views/samples/cached_action.html.erb +6 -0
  33. data/examples/al-admin/vendor/locale_rails/sample/app/views/samples/index.html.erb +33 -0
  34. data/examples/al-admin/vendor/locale_rails/sample/app/views/samples/index.pt.html.erb +16 -0
  35. data/examples/al-admin/vendor/locale_rails/sample/app/views/samples/index_uz_UZ.html.erb +16 -0
  36. data/examples/al-admin/vendor/locale_rails/sample/config/boot.rb +109 -0
  37. data/examples/al-admin/vendor/locale_rails/sample/config/environment.rb +25 -0
  38. data/examples/al-admin/vendor/locale_rails/sample/config/environments/development.rb +17 -0
  39. data/examples/al-admin/vendor/locale_rails/sample/config/environments/production.rb +24 -0
  40. data/examples/al-admin/vendor/locale_rails/sample/config/environments/test.rb +22 -0
  41. data/examples/al-admin/vendor/locale_rails/sample/config/initializers/inflections.rb +10 -0
  42. data/examples/al-admin/vendor/locale_rails/sample/config/initializers/mime_types.rb +5 -0
  43. data/examples/al-admin/vendor/locale_rails/sample/config/initializers/new_rails_defaults.rb +17 -0
  44. data/examples/al-admin/vendor/locale_rails/sample/config/locales/en.yml +2 -0
  45. data/examples/al-admin/vendor/locale_rails/sample/config/locales/ja.yml +2 -0
  46. data/examples/al-admin/vendor/locale_rails/sample/config/routes.rb +13 -0
  47. data/examples/al-admin/vendor/locale_rails/sample/db/schema.rb +10 -0
  48. data/examples/al-admin/vendor/locale_rails/sample/public/404.html +30 -0
  49. data/examples/al-admin/vendor/locale_rails/sample/public/422.html +30 -0
  50. data/examples/al-admin/vendor/locale_rails/sample/public/500.html +33 -0
  51. data/examples/al-admin/vendor/locale_rails/sample/public/dispatch.cgi +10 -0
  52. data/examples/al-admin/vendor/locale_rails/sample/public/dispatch.fcgi +24 -0
  53. data/examples/al-admin/vendor/locale_rails/sample/public/dispatch.rb +10 -0
  54. data/examples/al-admin/vendor/locale_rails/sample/public/favicon.ico +0 -0
  55. data/examples/al-admin/vendor/locale_rails/sample/public/images/rails.png +0 -0
  56. data/examples/al-admin/vendor/locale_rails/sample/public/javascripts/application.js +2 -0
  57. data/examples/al-admin/vendor/locale_rails/sample/public/javascripts/controls.js +963 -0
  58. data/examples/al-admin/vendor/locale_rails/sample/public/javascripts/dragdrop.js +972 -0
  59. data/examples/al-admin/vendor/locale_rails/sample/public/javascripts/effects.js +1120 -0
  60. data/examples/al-admin/vendor/locale_rails/sample/public/javascripts/prototype.js +4221 -0
  61. data/examples/al-admin/vendor/locale_rails/sample/public/robots.txt +5 -0
  62. data/examples/al-admin/vendor/locale_rails/sample/public/stylesheets/locale.css +81 -0
  63. data/examples/al-admin/vendor/locale_rails/sample/public/stylesheets/scaffold.css +74 -0
  64. data/examples/al-admin/vendor/locale_rails/sample/script/about +4 -0
  65. data/examples/al-admin/vendor/locale_rails/sample/script/console +3 -0
  66. data/examples/al-admin/vendor/locale_rails/sample/script/dbconsole +3 -0
  67. data/examples/al-admin/vendor/locale_rails/sample/script/destroy +3 -0
  68. data/examples/al-admin/vendor/locale_rails/sample/script/generate +3 -0
  69. data/examples/al-admin/vendor/locale_rails/sample/script/performance/benchmarker +3 -0
  70. data/examples/al-admin/vendor/locale_rails/sample/script/performance/profiler +3 -0
  71. data/examples/al-admin/vendor/locale_rails/sample/script/performance/request +3 -0
  72. data/examples/al-admin/vendor/locale_rails/sample/script/plugin +3 -0
  73. data/examples/al-admin/vendor/locale_rails/sample/script/process/inspector +3 -0
  74. data/examples/al-admin/vendor/locale_rails/sample/script/process/reaper +3 -0
  75. data/examples/al-admin/vendor/locale_rails/sample/script/process/spawner +3 -0
  76. data/examples/al-admin/vendor/locale_rails/sample/script/runner +3 -0
  77. data/examples/al-admin/vendor/locale_rails/sample/script/server +3 -0
  78. data/examples/al-admin/vendor/locale_rails/sample/test/performance/browsing_test.rb +9 -0
  79. data/examples/al-admin/vendor/locale_rails/sample/test/test_helper.rb +38 -0
  80. data/examples/al-admin/vendor/locale_rails/test/README +243 -0
  81. data/examples/al-admin/vendor/locale_rails/test/Rakefile +10 -0
  82. data/examples/al-admin/vendor/locale_rails/test/app/controllers/application_controller.rb +10 -0
  83. data/examples/al-admin/vendor/locale_rails/test/app/controllers/articles_controller.rb +17 -0
  84. data/examples/al-admin/vendor/locale_rails/test/app/helpers/application_helper.rb +3 -0
  85. data/examples/al-admin/vendor/locale_rails/test/app/views/articles/index.html.erb +1 -0
  86. data/examples/al-admin/vendor/locale_rails/test/app/views/articles/index_de.html.erb +1 -0
  87. data/examples/al-admin/vendor/locale_rails/test/app/views/articles/index_fr_FR.html.erb +1 -0
  88. data/examples/al-admin/vendor/locale_rails/test/app/views/articles/index_ja.html.erb +1 -0
  89. data/examples/al-admin/vendor/locale_rails/test/app/views/articles/list.html.erb +1 -0
  90. data/examples/al-admin/vendor/locale_rails/test/app/views/articles/show.html.erb +0 -0
  91. data/examples/al-admin/vendor/locale_rails/test/app/views/articles/show.js.rjs +0 -0
  92. data/examples/al-admin/vendor/locale_rails/test/config/boot.rb +110 -0
  93. data/examples/al-admin/vendor/locale_rails/test/config/environment.rb +42 -0
  94. data/examples/al-admin/vendor/locale_rails/test/config/environments/development.rb +17 -0
  95. data/examples/al-admin/vendor/locale_rails/test/config/environments/production.rb +28 -0
  96. data/examples/al-admin/vendor/locale_rails/test/config/environments/test.rb +35 -0
  97. data/examples/al-admin/vendor/locale_rails/test/config/initializers/backtrace_silencers.rb +7 -0
  98. data/examples/al-admin/vendor/locale_rails/test/config/initializers/inflections.rb +10 -0
  99. data/examples/al-admin/vendor/locale_rails/test/config/initializers/mime_types.rb +5 -0
  100. data/examples/al-admin/vendor/locale_rails/test/config/initializers/new_rails_defaults.rb +19 -0
  101. data/examples/al-admin/vendor/locale_rails/test/config/initializers/session_store.rb +15 -0
  102. data/examples/al-admin/vendor/locale_rails/test/config/locales/en.yml +5 -0
  103. data/examples/al-admin/vendor/locale_rails/test/config/routes.rb +46 -0
  104. data/examples/al-admin/vendor/locale_rails/test/db/schema.rb +0 -0
  105. data/examples/al-admin/vendor/locale_rails/test/public/404.html +30 -0
  106. data/examples/al-admin/vendor/locale_rails/test/public/422.html +30 -0
  107. data/examples/al-admin/vendor/locale_rails/test/public/500.html +30 -0
  108. data/examples/al-admin/vendor/locale_rails/test/public/favicon.ico +0 -0
  109. data/examples/al-admin/vendor/locale_rails/test/public/images/rails.png +0 -0
  110. data/examples/al-admin/vendor/locale_rails/test/public/index.html +275 -0
  111. data/examples/al-admin/vendor/locale_rails/test/public/javascripts/application.js +2 -0
  112. data/examples/al-admin/vendor/locale_rails/test/public/javascripts/controls.js +963 -0
  113. data/examples/al-admin/vendor/locale_rails/test/public/javascripts/dragdrop.js +973 -0
  114. data/examples/al-admin/vendor/locale_rails/test/public/javascripts/effects.js +1128 -0
  115. data/examples/al-admin/vendor/locale_rails/test/public/javascripts/prototype.js +4320 -0
  116. data/examples/al-admin/vendor/locale_rails/test/public/robots.txt +5 -0
  117. data/examples/al-admin/vendor/locale_rails/test/script/about +4 -0
  118. data/examples/al-admin/vendor/locale_rails/test/script/console +3 -0
  119. data/examples/al-admin/vendor/locale_rails/test/script/dbconsole +3 -0
  120. data/examples/al-admin/vendor/locale_rails/test/script/destroy +3 -0
  121. data/examples/al-admin/vendor/locale_rails/test/script/generate +3 -0
  122. data/examples/al-admin/vendor/locale_rails/test/script/performance/benchmarker +3 -0
  123. data/examples/al-admin/vendor/locale_rails/test/script/performance/profiler +3 -0
  124. data/examples/al-admin/vendor/locale_rails/test/script/plugin +3 -0
  125. data/examples/al-admin/vendor/locale_rails/test/script/runner +3 -0
  126. data/examples/al-admin/vendor/locale_rails/test/script/server +3 -0
  127. data/examples/al-admin/vendor/locale_rails/test/test/functional/articles_controller_test.rb +161 -0
  128. data/examples/al-admin/vendor/locale_rails/test/test/performance/browsing_test.rb +9 -0
  129. data/examples/al-admin/vendor/locale_rails/test/test/test_helper.rb +38 -0
  130. data/lib/active_ldap.rb +9 -4
  131. data/lib/active_ldap/adapter/base.rb +3 -3
  132. data/lib/active_ldap/adapter/jndi.rb +1 -1
  133. data/lib/active_ldap/adapter/jndi_connection.rb +1 -3
  134. data/lib/active_ldap/adapter/ldap.rb +11 -11
  135. data/lib/active_ldap/adapter/ldap_ext.rb +25 -3
  136. data/lib/active_ldap/adapter/net_ldap.rb +9 -2
  137. data/lib/active_ldap/association/collection.rb +14 -2
  138. data/lib/active_ldap/base.rb +13 -5
  139. data/lib/active_ldap/configuration.rb +1 -0
  140. data/lib/active_ldap/ldap_error.rb +3 -3
  141. data/lib/active_ldap/ldif.rb +1 -1
  142. data/lib/active_ldap/operations.rb +2 -0
  143. data/lib/active_ldap/schema/syntaxes.rb +2 -2
  144. data/lib/active_ldap/validations.rb +37 -26
  145. data/lib/active_ldap/xml.rb +2 -0
  146. data/po/active-ldap.pot +38 -58
  147. data/test-unit/COPYING +56 -0
  148. data/test-unit/GPL +340 -0
  149. data/test-unit/History.txt +65 -3
  150. data/test-unit/Manifest.txt +5 -0
  151. data/test-unit/PSFL +271 -0
  152. data/test-unit/README.txt +6 -1
  153. data/test-unit/lib/test/unit.rb +6 -1
  154. data/test-unit/lib/test/unit/assertions.rb +129 -13
  155. data/test-unit/lib/test/unit/autorunner.rb +21 -16
  156. data/test-unit/lib/test/unit/collector.rb +1 -8
  157. data/test-unit/lib/test/unit/collector/dir.rb +1 -1
  158. data/test-unit/lib/test/unit/collector/load.rb +15 -7
  159. data/test-unit/lib/test/unit/color-scheme.rb +6 -2
  160. data/test-unit/lib/test/unit/diff.rb +17 -1
  161. data/test-unit/lib/test/unit/error.rb +4 -0
  162. data/test-unit/lib/test/unit/failure.rb +4 -0
  163. data/test-unit/lib/test/unit/notification.rb +8 -4
  164. data/test-unit/lib/test/unit/omission.rb +4 -0
  165. data/test-unit/lib/test/unit/pending.rb +4 -0
  166. data/test-unit/lib/test/unit/priority.rb +2 -3
  167. data/test-unit/lib/test/unit/testcase.rb +18 -7
  168. data/test-unit/lib/test/unit/ui/console/testrunner.rb +5 -3
  169. data/test-unit/lib/test/unit/util/backtracefilter.rb +1 -0
  170. data/test-unit/lib/test/unit/util/output.rb +31 -0
  171. data/test-unit/lib/test/unit/version.rb +1 -1
  172. data/test-unit/test/collector/test-descendant.rb +2 -4
  173. data/test-unit/test/collector/test-load.rb +121 -8
  174. data/test-unit/test/collector/test_objectspace.rb +7 -5
  175. data/test-unit/test/test-color-scheme.rb +4 -2
  176. data/test-unit/test/test-testcase.rb +48 -38
  177. data/test-unit/test/test_assertions.rb +87 -5
  178. data/test-unit/test/util/test-output.rb +11 -0
  179. data/test/al-test-utils.rb +6 -1
  180. data/test/fixtures/lower_case_object_class_schema.rb +802 -0
  181. data/test/test_associations.rb +20 -1
  182. data/test/test_base.rb +50 -3
  183. data/test/test_ldif.rb +10 -1
  184. data/test/test_syntax.rb +12 -0
  185. data/test/test_validation.rb +0 -2
  186. metadata +225 -56
@@ -73,7 +73,7 @@ module ActiveLdap
73
73
  }
74
74
  info = {
75
75
  :base => base, :scope => scope_name(scope),
76
- :filter => filter, :attributes => attrs,
76
+ :filter => filter, :attributes => attrs, :limit => limit
77
77
  }
78
78
  execute(:search, info, args) do |entry|
79
79
  attributes = {}
@@ -138,7 +138,13 @@ module ActiveLdap
138
138
  private
139
139
  def execute(method, info=nil, *args, &block)
140
140
  name = (info || {}).delete(:name) || method
141
- result = log(name, info) {@connection.send(method, *args, &block)}
141
+ result = log(name, info) do
142
+ begin
143
+ @connection.send(method, *args, &block)
144
+ rescue Errno::EPIPE
145
+ raise ConnectionError, "#{$!.class}: #{$!.message}"
146
+ end
147
+ end
142
148
  message = nil
143
149
  if result.is_a?(Hash)
144
150
  message = result[:errorMessage]
@@ -147,6 +153,7 @@ module ActiveLdap
147
153
  unless result.zero?
148
154
  klass = LdapError::ERRORS[result]
149
155
  klass ||= LdapError
156
+ return if klass == LdapError::SizeLimitExceeded
150
157
  message = [Net::LDAP.result2string(result), message].compact.join(": ")
151
158
  raise klass, message
152
159
  end
@@ -40,8 +40,20 @@ module ActiveLdap
40
40
 
41
41
  def replace(others)
42
42
  load_target
43
- deleted_entries = @target - others
44
- added_entries = others - @target
43
+
44
+ entry = @target.first
45
+ if entry.nil?
46
+ deleted_entries = []
47
+ added_entries = others
48
+ else
49
+ base_class = entry.class
50
+ others = others.collect do |other|
51
+ other = base_class.find(other) unless other.is_a?(base_class)
52
+ other
53
+ end
54
+ deleted_entries = @target - others
55
+ added_entries = others - @target
56
+ end
45
57
 
46
58
  delete(deleted_entries)
47
59
  concat(added_entries)
@@ -588,7 +588,7 @@ module ActiveLdap
588
588
  require 'logger'
589
589
  @@logger = Logger.new(STDERR)
590
590
  @@logger.progname = 'ActiveLdap'
591
- @@logger.level = Logger::UNKNOWN
591
+ @@logger.level = Logger::ERROR
592
592
  end
593
593
  configuration[:logger] ||= @@logger
594
594
  end
@@ -1109,12 +1109,17 @@ module ActiveLdap
1109
1109
  "#{name}: #{values.inspect}"
1110
1110
  end
1111
1111
 
1112
+ def find_object_class_values(data)
1113
+ data["objectClass"] || data["objectclass"]
1114
+ end
1115
+
1112
1116
  def attribute_name_resolvable_without_connection?
1113
1117
  @entry_attribute and @local_entry_attribute
1114
1118
  end
1115
1119
 
1116
1120
  def entry_attribute
1117
- @entry_attribute ||= connection.entry_attribute(@data["objectClass"] || [])
1121
+ @entry_attribute ||=
1122
+ connection.entry_attribute(find_object_class_values(@data) || [])
1118
1123
  end
1119
1124
 
1120
1125
  def local_entry_attribute
@@ -1240,7 +1245,8 @@ module ActiveLdap
1240
1245
  def get_attribute_before_type_cast(name, force_array=false)
1241
1246
  name = to_real_attribute_name(name)
1242
1247
 
1243
- value = @data[name] || []
1248
+ value = @data[name]
1249
+ value = [] if value.nil?
1244
1250
  [name, array_of(value, force_array)]
1245
1251
  end
1246
1252
 
@@ -1510,8 +1516,9 @@ module ActiveLdap
1510
1516
 
1511
1517
  oc_value = data['objectClass']
1512
1518
  attributes.push(['objectClass', oc_value])
1519
+ except_keys = ['objectClass', dn_attr].collect(&:downcase)
1513
1520
  data.each do |key, value|
1514
- next if key == 'objectClass' or key == dn_attr
1521
+ next if except_keys.include?(key.downcase)
1515
1522
  value = self.class.remove_blank_value(value)
1516
1523
  next if self.class.blank_value?(value)
1517
1524
 
@@ -1532,8 +1539,9 @@ module ActiveLdap
1532
1539
  ldap_data = normalize_data(@ldap_data)
1533
1540
 
1534
1541
  # Expand subtypes to real data attributes, but leave @data alone
1542
+ object_classes = find_object_class_values(@ldap_data) || []
1535
1543
  original_attributes =
1536
- connection.entry_attribute(@ldap_data["objectClass"] || []).names
1544
+ connection.entry_attribute(object_classes).names
1537
1545
  bad_attrs = original_attributes - entry_attribute.names
1538
1546
  data = normalize_data(@data, bad_attrs)
1539
1547
 
@@ -33,6 +33,7 @@ module ActiveLdap
33
33
  DEFAULT_CONFIG[:allow_anonymous] = true
34
34
  DEFAULT_CONFIG[:sasl_quiet] = true
35
35
  DEFAULT_CONFIG[:try_sasl] = false
36
+ DEFAULT_CONFIG[:sasl_options] = nil
36
37
  # See http://www.iana.org/assignments/sasl-mechanisms
37
38
  DEFAULT_CONFIG[:sasl_mechanisms] = ["GSSAPI", "DIGEST-MD5",
38
39
  "CRAM-MD5", "EXTERNAL"]
@@ -20,8 +20,8 @@ EOC
20
20
  0x00 => "SUCCESS",
21
21
  0x01 => "OPERATIONS_ERROR",
22
22
  0x02 => "PROTOCOL_ERROR",
23
- 0x03 => "TIMELIMIT_EXCEEDED",
24
- 0x04 => "SIZELIMIT_EXCEEDED",
23
+ 0x03 => "TIME_LIMIT_EXCEEDED",
24
+ 0x04 => "SIZE_LIMIT_EXCEEDED",
25
25
  0x05 => "COMPARE_FALSE",
26
26
  0x06 => "COMPARE_TRUE",
27
27
  0x07 => "AUTH_METHOD_NOT_SUPPORTED",
@@ -29,7 +29,7 @@ EOC
29
29
  0x09 => "PARTIAL_RESULTS", # LDAPv2+ (not LDAPv3)
30
30
 
31
31
  0x0a => "REFERRAL",
32
- 0x0b => "ADMINLIMIT_EXCEEDED",
32
+ 0x0b => "ADMIN_LIMIT_EXCEEDED",
33
33
  0x0c => "UNAVAILABLE_CRITICAL_EXTENSION",
34
34
  0x0d => "CONFIDENTIALITY_REQUIRED",
35
35
  0x0e => "LDAP_SASL_BIND_IN_PROGRESS",
@@ -46,7 +46,7 @@ module ActiveLdap
46
46
  return "#{name}:\n" if value.blank?
47
47
  result = "#{name}:"
48
48
 
49
- value = value.to_s if value.is_a?(DN)
49
+ value = value.to_s unless value.is_a?(String)
50
50
  if value[-1, 1] == ' ' or binary_value?(value)
51
51
  result << ":"
52
52
  value = [value].pack("m").gsub(/\n/, '')
@@ -83,6 +83,7 @@ module ActiveLdap
83
83
  :attribute => attr,
84
84
  :value => value,
85
85
  :prefix => prefix,
86
+ :limit => 1,
86
87
  }
87
88
 
88
89
  attribute = attr || ensure_search_attribute
@@ -90,6 +91,7 @@ module ActiveLdap
90
91
  :attribute => attr,
91
92
  :value => value,
92
93
  :prefix => ["#{attribute}=#{value}", prefix].compact.join(","),
94
+ :limit => 1,
93
95
  :scope => :base,
94
96
  }
95
97
 
@@ -91,9 +91,9 @@ module ActiveLdap
91
91
 
92
92
  def normalize_value(value)
93
93
  case value
94
- when true
94
+ when true, "1"
95
95
  "TRUE"
96
- when false
96
+ when false, "0"
97
97
  "FALSE"
98
98
  else
99
99
  value
@@ -87,6 +87,20 @@ module ActiveLdap
87
87
  end
88
88
 
89
89
  private
90
+ def format_validation_message(format, parameters)
91
+ if ActiveLdap.get_text_supported?
92
+ if /\A(%\{fn\})/ =~ format
93
+ place_holder = $1
94
+ format = $POSTMATCH
95
+ else
96
+ place_holder = ""
97
+ end
98
+ "#{place_holder}#{format % parameters}"
99
+ else
100
+ format.sub(/\A%\{fn\} ?/, '') % parameters
101
+ end
102
+ end
103
+
90
104
  def validate_duplicated_dn_creation
91
105
  _dn = nil
92
106
  begin
@@ -96,10 +110,8 @@ module ActiveLdap
96
110
  end
97
111
  if _dn and exist?
98
112
  format = _("%{fn} is duplicated: %s")
99
- unless ActiveLdap.get_text_supported?
100
- format = format.sub(/^%\{fn\} /, '')
101
- end
102
- errors.add("distinguishedName", format % _dn)
113
+ message = format_validation_message(format, _dn)
114
+ errors.add("distinguishedName", message)
103
115
  end
104
116
  end
105
117
 
@@ -118,10 +130,8 @@ module ActiveLdap
118
130
  end
119
131
  if _dn and exist?
120
132
  format = _("%{fn} is duplicated: %s")
121
- unless ActiveLdap.get_text_supported?
122
- format = format.sub(/^%\{fn\} /, '')
123
- end
124
- errors.add("distinguishedName", format % _dn)
133
+ message = format_validation_message(format, _dn)
134
+ errors.add("distinguishedName", message)
125
135
  end
126
136
  end
127
137
 
@@ -129,23 +139,28 @@ module ActiveLdap
129
139
  dn
130
140
  rescue DistinguishedNameInvalid
131
141
  format = _("%{fn} is invalid: %s")
132
- format = format.sub(/^%\{fn\} /, '') unless ActiveLdap.get_text_supported?
133
- errors.add("distinguishedName", format % $!.message)
142
+ message = format_validation_message(format, $!.message)
143
+ errors.add("distinguishedName", message)
134
144
  rescue DistinguishedNameNotSetError
135
145
  format = _("%{fn} isn't set: %s")
136
- format = format.sub(/^%\{fn\} /, '') unless ActiveLdap.get_text_supported?
137
- errors.add("distinguishedName", format % $!.message)
146
+ message = format_validation_message(format, $!.message)
147
+ errors.add("distinguishedName", message)
138
148
  end
139
149
 
140
150
  def validate_excluded_classes
141
- return if self.class.excluded_classes.empty?
151
+ excluded_classes = self.class.excluded_classes
152
+ return if excluded_classes.empty?
142
153
 
143
154
  _schema = schema
144
- unexpected_classes = self.class.excluded_classes.collect do |name|
155
+ _classes = classes.collect do |name|
145
156
  _schema.object_class(name)
146
157
  end
147
- unexpected_classes -= classes.collect do |name|
148
- _schema.object_class(name)
158
+ unexpected_classes = excluded_classes.inject([]) do |classes, name|
159
+ excluded_class = _schema.object_class(name)
160
+ if _classes.include?(excluded_class)
161
+ classes << excluded_class
162
+ end
163
+ classes
149
164
  end
150
165
  return if unexpected_classes.empty?
151
166
 
@@ -155,8 +170,8 @@ module ActiveLdap
155
170
  format = n_("%{fn} has excluded value: %s",
156
171
  "%{fn} has excluded values: %s",
157
172
  names.size)
158
- format = format.sub(/^%\{fn\} /, '') unless ActiveLdap.get_text_supported?
159
- errors.add("objectClass", format % names.join(", "))
173
+ message = format_validation_message(format, names.join(", "))
174
+ errors.add("objectClass", message)
160
175
  end
161
176
 
162
177
  # validate_required_ldap_values
@@ -195,10 +210,8 @@ module ActiveLdap
195
210
  "'%s': aliases: %s")
196
211
  args << aliases.join(', ')
197
212
  end
198
- unless ActiveLdap.get_text_supported?
199
- format = format.sub(/^%\{fn\} /, '')
200
- end
201
- errors.add(real_name, format % args)
213
+ message = format_validation_message(format, args)
214
+ errors.add(real_name, message)
202
215
  end
203
216
  end
204
217
  end
@@ -228,10 +241,8 @@ module ActiveLdap
228
241
  format = _("%{fn} has invalid format: %s: required syntax: %s: %s")
229
242
  end
230
243
  params.unshift(option) if option
231
- unless ActiveLdap.get_text_supported?
232
- format = format.sub(/^%\{fn\} ?/, '')
233
- end
234
- errors.add(name, format % params)
244
+ message = format_validation_message(format, params)
245
+ errors.add(name, message)
235
246
  end
236
247
  end
237
248
  end
@@ -68,6 +68,8 @@ module ActiveLdap
68
68
  end
69
69
  when DN
70
70
  targets.concat(normalize_value(value.to_s, options))
71
+ when nil
72
+ # ignore
71
73
  else
72
74
  if /\A#{PRINTABLE_STRING}\z/ !~ value
73
75
  value = [value].pack("m").gsub(/\n/u, '')
@@ -6,9 +6,9 @@
6
6
  #, fuzzy
7
7
  msgid ""
8
8
  msgstr ""
9
- "Project-Id-Version: Ruby/ActiveLdap 1.1.1\n"
10
- "POT-Creation-Date: 2009-08-04 23:26+0900\n"
11
- "PO-Revision-Date: 2009-08-04 22:43+0900\n"
9
+ "Project-Id-Version: Ruby/ActiveLdap 1.0.9\n"
10
+ "POT-Creation-Date: 2009-07-09 22:48+0900\n"
11
+ "PO-Revision-Date: 2007-08-12 18:02+0900\n"
12
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
14
  "MIME-Version: 1.0\n"
@@ -772,10 +772,6 @@ msgstr ""
772
772
  msgid "LDAP|Attribute|olcRootPW"
773
773
  msgstr ""
774
774
 
775
- #: -:-
776
- msgid "LDAP|Attribute|olcSaslAuxprops"
777
- msgstr ""
778
-
779
775
  #: -:-
780
776
  msgid "LDAP|Attribute|olcSaslHost"
781
777
  msgstr ""
@@ -892,10 +888,6 @@ msgstr ""
892
888
  msgid "LDAP|Attribute|olcUpdateRef"
893
889
  msgstr ""
894
890
 
895
- #: -:-
896
- msgid "LDAP|Attribute|olcWriteTimeout"
897
- msgstr ""
898
-
899
891
  #: -:-
900
892
  msgid "LDAP|Attribute|oncRpcNumber"
901
893
  msgstr ""
@@ -3441,17 +3433,17 @@ msgstr ""
3441
3433
  msgid "Can't remove required objectClass: %s"
3442
3434
  msgstr ""
3443
3435
 
3444
- #: lib/active_ldap/adapter/jndi.rb:105 lib/active_ldap/adapter/ldap.rb:203
3436
+ #: lib/active_ldap/adapter/jndi.rb:105 lib/active_ldap/adapter/ldap.rb:197
3445
3437
  #: lib/active_ldap/adapter/net_ldap.rb:155
3446
3438
  msgid "%s is not one of the available connect methods: %s"
3447
3439
  msgstr ""
3448
3440
 
3449
- #: lib/active_ldap/adapter/jndi.rb:118 lib/active_ldap/adapter/ldap.rb:216
3441
+ #: lib/active_ldap/adapter/jndi.rb:118 lib/active_ldap/adapter/ldap.rb:210
3450
3442
  #: lib/active_ldap/adapter/net_ldap.rb:168
3451
3443
  msgid "%s is not one of the available LDAP scope: %s"
3452
3444
  msgstr ""
3453
3445
 
3454
- #: lib/active_ldap/adapter/jndi.rb:176 lib/active_ldap/adapter/ldap.rb:280
3446
+ #: lib/active_ldap/adapter/jndi.rb:176 lib/active_ldap/adapter/ldap.rb:274
3455
3447
  #: lib/active_ldap/adapter/net_ldap.rb:290
3456
3448
  msgid "unknown type: %s"
3457
3449
  msgstr ""
@@ -3460,10 +3452,6 @@ msgstr ""
3460
3452
  msgid "No matches: filter: %s: attributes: %s"
3461
3453
  msgstr ""
3462
3454
 
3463
- #: lib/active_ldap/adapter/ldap.rb:162
3464
- msgid "modify RDN with new superior"
3465
- msgstr ""
3466
-
3467
3455
  #: lib/active_ldap/adapter/net_ldap.rb:211
3468
3456
  msgid "unsupported qops: %s"
3469
3457
  msgstr ""
@@ -3566,17 +3554,13 @@ msgstr ""
3566
3554
  msgid "Couldn't find all %s: DNs (%s)"
3567
3555
  msgstr ""
3568
3556
 
3569
- #: lib/active_ldap/operations.rb:504
3570
- msgid "Failed to delete LDAP entry: <%s>: %s"
3571
- msgstr ""
3572
-
3573
3557
  #: lib/active_ldap/associations.rb:68
3574
3558
  msgid ""
3575
3559
  ":foreign_key belongs_to(:many) option is deprecated since 1.1.0. Use :"
3576
3560
  "primary_key instead."
3577
3561
  msgstr ""
3578
3562
 
3579
- #: lib/active_ldap/associations.rb:136
3563
+ #: lib/active_ldap/associations.rb:135
3580
3564
  msgid ""
3581
3565
  ":primary_key and :foreign_key has_many options are inverted their mean since "
3582
3566
  "1.1.0. Please invert them."
@@ -3710,41 +3694,37 @@ msgstr ""
3710
3694
  msgid "%s isn't sub DN of %s"
3711
3695
  msgstr ""
3712
3696
 
3713
- #: lib/active_ldap/validations.rb:97
3697
+ #: lib/active_ldap/validations.rb:85
3714
3698
  msgid "%{fn} is duplicated: %s"
3715
3699
  msgstr ""
3716
3700
 
3717
- #: lib/active_ldap/validations.rb:108
3701
+ #: lib/active_ldap/validations.rb:96
3718
3702
  msgid "%{fn} is invalid: %s"
3719
3703
  msgstr ""
3720
3704
 
3721
- #: lib/active_ldap/validations.rb:112
3705
+ #: lib/active_ldap/validations.rb:100
3722
3706
  msgid "%{fn} isn't set: %s"
3723
3707
  msgstr ""
3724
3708
 
3725
- #: lib/active_ldap/validations.rb:134
3709
+ #: lib/active_ldap/validations.rb:122
3726
3710
  msgid "%{fn} has excluded value: %s"
3727
3711
  msgid_plural "%{fn} has excluded values: %s"
3728
3712
  msgstr[0] ""
3729
3713
  msgstr[1] ""
3730
3714
 
3731
- #: lib/active_ldap/validations.rb:169
3715
+ #: lib/active_ldap/validations.rb:152
3732
3716
  msgid "%{fn} is required attribute by objectClass '%s'"
3733
3717
  msgstr ""
3734
3718
 
3735
- #: lib/active_ldap/validations.rb:171
3719
+ #: lib/active_ldap/validations.rb:154
3736
3720
  msgid "%{fn} is required attribute by objectClass '%s': aliases: %s"
3737
3721
  msgstr ""
3738
3722
 
3739
- #: lib/active_ldap/validations.rb:195
3740
- msgid "<binary-value>"
3741
- msgstr ""
3742
-
3743
- #: lib/active_ldap/validations.rb:203
3723
+ #: lib/active_ldap/validations.rb:181
3744
3724
  msgid "%{fn}(%s) has invalid format: %s: required syntax: %s: %s"
3745
3725
  msgstr ""
3746
3726
 
3747
- #: lib/active_ldap/validations.rb:205
3727
+ #: lib/active_ldap/validations.rb:183
3748
3728
  msgid "%{fn} has invalid format: %s: required syntax: %s: %s"
3749
3729
  msgstr ""
3750
3730
 
@@ -3798,47 +3778,47 @@ msgstr ""
3798
3778
  msgid "%s is unknown attribute"
3799
3779
  msgstr ""
3800
3780
 
3801
- #: lib/active_ldap/base.rb:266
3802
- msgid "not implemented: %s"
3803
- msgstr ""
3804
-
3805
- #: lib/active_ldap/base.rb:382
3781
+ #: lib/active_ldap/base.rb:374
3806
3782
  msgid ""
3807
3783
  "ActiveLdap::Base.establish_connection has been deprecated since 1.1.0. "
3808
3784
  "Please use ActiveLdap::Base.setup_connection instead."
3809
3785
  msgstr ""
3810
3786
 
3811
- #: lib/active_ldap/base.rb:463
3787
+ #: lib/active_ldap/base.rb:455
3812
3788
  msgid "scope '%s' must be a Symbol"
3813
3789
  msgstr ""
3814
3790
 
3815
- #: lib/active_ldap/base.rb:514
3791
+ #: lib/active_ldap/base.rb:500
3816
3792
  msgid "%s doesn't belong in a hierarchy descending from ActiveLdap"
3817
3793
  msgstr ""
3818
3794
 
3819
- #: lib/active_ldap/base.rb:669
3795
+ #: lib/active_ldap/base.rb:655
3820
3796
  msgid ""
3821
3797
  "'%s' must be either nil, DN value as ActiveLdap::DN, String or Array or "
3822
3798
  "attributes as Hash"
3823
3799
  msgstr ""
3824
3800
 
3825
- #: lib/active_ldap/base.rb:799
3801
+ #: lib/active_ldap/base.rb:770
3802
+ msgid "Failed to delete LDAP entry: %s"
3803
+ msgstr ""
3804
+
3805
+ #: lib/active_ldap/base.rb:789
3826
3806
  msgid "entry %s can't be saved"
3827
3807
  msgstr ""
3828
3808
 
3829
- #: lib/active_ldap/base.rb:832 lib/active_ldap/base.rb:843
3809
+ #: lib/active_ldap/base.rb:808 lib/active_ldap/base.rb:819
3830
3810
  msgid "wrong number of arguments (%d for 1)"
3831
3811
  msgstr ""
3832
3812
 
3833
- #: lib/active_ldap/base.rb:964
3813
+ #: lib/active_ldap/base.rb:940
3834
3814
  msgid "Can't find DN '%s' to reload"
3835
3815
  msgstr ""
3836
3816
 
3837
- #: lib/active_ldap/base.rb:1369
3817
+ #: lib/active_ldap/base.rb:1337
3838
3818
  msgid "%s's DN attribute (%s) isn't set"
3839
3819
  msgstr ""
3840
3820
 
3841
- #: lib/active_ldap/attributes.rb:80
3821
+ #: lib/active_ldap/attributes.rb:76
3842
3822
  msgid "The first argument, name, must not be nil. Please report this as a bug!"
3843
3823
  msgstr ""
3844
3824
 
@@ -3864,7 +3844,7 @@ msgid ""
3864
3844
  "Please use ActiveLdap::Connection.setup_connection instead."
3865
3845
  msgstr ""
3866
3846
 
3867
- #: lib/active_ldap/connection.rb:236
3847
+ #: lib/active_ldap/connection.rb:229
3868
3848
  msgid "since 1.1.0. "
3869
3849
  msgstr ""
3870
3850
 
@@ -3958,7 +3938,7 @@ msgstr ""
3958
3938
  msgid "%s has unprintable character: '%s'"
3959
3939
  msgstr ""
3960
3940
 
3961
- #: lib/active_ldap/get_text/parser.rb:96
3941
+ #: lib/active_ldap/get_text/parser.rb:94
3962
3942
  msgid "Ignored '%{file}'. Solve dependencies first."
3963
3943
  msgstr ""
3964
3944
 
@@ -3994,37 +3974,37 @@ msgstr ""
3994
3974
  msgid "(default: %s)"
3995
3975
  msgstr ""
3996
3976
 
3997
- #: benchmark/bench-al.rb:186
3977
+ #: benchmark/bench-al.rb:219
3998
3978
  msgid "Populating..."
3999
3979
  msgstr ""
4000
3980
 
4001
- #: benchmark/bench-al.rb:243
3981
+ #: benchmark/bench-al.rb:276
4002
3982
  msgid "Entries processed by Ruby/ActiveLdap + LDAP: %d"
4003
3983
  msgstr ""
4004
3984
 
4005
- #: benchmark/bench-al.rb:244
3985
+ #: benchmark/bench-al.rb:277
4006
3986
  msgid "Entries processed by Ruby/ActiveLdap + Net::LDAP: %d"
4007
3987
  msgstr ""
4008
3988
 
4009
- #: benchmark/bench-al.rb:246
3989
+ #: benchmark/bench-al.rb:279
4010
3990
  msgid ""
4011
3991
  "Entries processed by Ruby/ActiveLdap + LDAP: (without object creation): %d"
4012
3992
  msgstr ""
4013
3993
 
4014
- #: benchmark/bench-al.rb:249
3994
+ #: benchmark/bench-al.rb:282
4015
3995
  msgid ""
4016
3996
  "Entries processed by Ruby/ActiveLdap + Net::LDAP: (without object creation): "
4017
3997
  "%d"
4018
3998
  msgstr ""
4019
3999
 
4020
- #: benchmark/bench-al.rb:252
4000
+ #: benchmark/bench-al.rb:285
4021
4001
  msgid "Entries processed by Ruby/LDAP: %d"
4022
4002
  msgstr ""
4023
4003
 
4024
- #: benchmark/bench-al.rb:253
4004
+ #: benchmark/bench-al.rb:286
4025
4005
  msgid "Entries processed by Net::LDAP: %d"
4026
4006
  msgstr ""
4027
4007
 
4028
- #: benchmark/bench-al.rb:257
4008
+ #: benchmark/bench-al.rb:290
4029
4009
  msgid "Cleaning..."
4030
4010
  msgstr ""