activeldap 5.2.4 → 6.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +3 -1
- data/doc/text/development.md +26 -0
- data/doc/text/{news.textile → news.md} +367 -271
- data/doc/text/{rails.textile → rails.md} +44 -33
- data/doc/text/{tutorial.textile → tutorial.md} +177 -185
- data/lib/active_ldap/adapter/base.rb +30 -10
- data/lib/active_ldap/adapter/jndi.rb +21 -9
- data/lib/active_ldap/adapter/jndi_connection.rb +83 -20
- data/lib/active_ldap/adapter/ldap.rb +13 -22
- data/lib/active_ldap/adapter/ldap_ext.rb +32 -13
- data/lib/active_ldap/adapter/net_ldap.rb +9 -18
- data/lib/active_ldap/base.rb +11 -1
- data/lib/active_ldap/configuration.rb +24 -1
- data/lib/active_ldap/connection.rb +2 -2
- data/lib/active_ldap/human_readable.rb +5 -4
- data/lib/active_ldap/operations.rb +21 -4
- data/lib/active_ldap/persistence.rb +3 -2
- data/lib/active_ldap/validations.rb +12 -4
- data/lib/active_ldap/version.rb +1 -1
- data/lib/active_ldap.rb +0 -1
- data/test/add-phonetic-attribute-options-to-slapd.ldif +1 -1
- data/test/al-test-utils.rb +125 -38
- data/test/enable-dynamic-groups.ldif +22 -0
- data/test/enable-start-tls.ldif +1 -1
- data/test/run-test.rb +0 -4
- data/test/test_base.rb +76 -18
- data/test/test_base_per_instance.rb +33 -1
- data/test/test_connection.rb +4 -0
- data/test/test_entry.rb +1 -0
- data/test/test_find.rb +12 -2
- data/test/test_supported_control.rb +1 -1
- data/test/test_validation.rb +28 -15
- metadata +16 -30
- data/README.textile +0 -141
- data/doc/text/development.textile +0 -54
data/test/test_validation.rb
CHANGED
@@ -37,6 +37,15 @@ class TestValidation < Test::Unit::TestCase
|
|
37
37
|
priority :must
|
38
38
|
|
39
39
|
priority :normal
|
40
|
+
def test_validate_false
|
41
|
+
make_temporary_user(:simple => true) do |user,|
|
42
|
+
user.sn = nil
|
43
|
+
assert_raise(ActiveLdap::RequiredAttributeMissed) do
|
44
|
+
user.save(validate: false)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
40
49
|
def test_octet_string
|
41
50
|
make_temporary_user(:simple => true) do |user,|
|
42
51
|
utf8_encoded_binary_value = "\xff".force_encoding("UTF-8")
|
@@ -52,8 +61,8 @@ class TestValidation < Test::Unit::TestCase
|
|
52
61
|
user1.id = user2.id
|
53
62
|
assert_false(user1.save)
|
54
63
|
|
55
|
-
format =
|
56
|
-
format
|
64
|
+
format = human_attribute_name("distinguishedName")
|
65
|
+
format << " " << _("is duplicated: %s")
|
57
66
|
assert_equal([format % [user2.dn.to_s]],
|
58
67
|
user1.errors.full_messages)
|
59
68
|
end
|
@@ -66,8 +75,8 @@ class TestValidation < Test::Unit::TestCase
|
|
66
75
|
user.jpeg_photo = "XXX"
|
67
76
|
assert_not_predicate(user, :save)
|
68
77
|
|
69
|
-
format =
|
70
|
-
format <<
|
78
|
+
format = human_attribute_name('jpegPhoto')
|
79
|
+
format << " " << _("has invalid format: %s: required syntax: %s: %s")
|
71
80
|
arguments = [_("<binary-value>"),
|
72
81
|
lsd_("1.3.6.1.4.1.1466.115.121.1.28"),
|
73
82
|
_("invalid JPEG format")]
|
@@ -112,8 +121,8 @@ class TestValidation < Test::Unit::TestCase
|
|
112
121
|
reason = _("attribute value is missing")
|
113
122
|
invalid_format = _("%s is invalid distinguished name (DN): %s")
|
114
123
|
invalid_message = invalid_format % ["uid==,#{user.class.base}", reason]
|
115
|
-
format =
|
116
|
-
format <<
|
124
|
+
format = human_attribute_name("distinguishedName")
|
125
|
+
format << " " << _("is invalid: %s")
|
117
126
|
message = format % invalid_message
|
118
127
|
assert_equal([message],
|
119
128
|
user.errors.full_messages.find_all {|m| /DN/ =~ m})
|
@@ -126,8 +135,8 @@ class TestValidation < Test::Unit::TestCase
|
|
126
135
|
reason = _("attribute value is missing")
|
127
136
|
invalid_format = _("%s is invalid distinguished name (DN): %s")
|
128
137
|
invalid_message = invalid_format % ["uid==,#{user.class.base}", reason]
|
129
|
-
format =
|
130
|
-
format <<
|
138
|
+
format = human_attribute_name("distinguishedName")
|
139
|
+
format << " " << _("is invalid: %s")
|
131
140
|
message = format % invalid_message
|
132
141
|
assert_equal([message], user.errors.full_messages)
|
133
142
|
end
|
@@ -138,8 +147,8 @@ class TestValidation < Test::Unit::TestCase
|
|
138
147
|
assert(user.valid?)
|
139
148
|
user.uid_number = ""
|
140
149
|
assert(!user.valid?)
|
141
|
-
format =
|
142
|
-
format <<
|
150
|
+
format = human_attribute_name("uidNumber")
|
151
|
+
format << " " << _("is required attribute by objectClass '%s'")
|
143
152
|
blank_message = format % loc_("posixAccount")
|
144
153
|
assert_equal([blank_message], user.errors.full_messages)
|
145
154
|
end
|
@@ -150,8 +159,8 @@ class TestValidation < Test::Unit::TestCase
|
|
150
159
|
assert(user.save)
|
151
160
|
user.class.excluded_classes = ['person']
|
152
161
|
assert(!user.save)
|
153
|
-
format =
|
154
|
-
format <<
|
162
|
+
format = human_attribute_name("objectClass")
|
163
|
+
format << " " << n_("has excluded value: %s",
|
155
164
|
"has excluded values: %s",
|
156
165
|
1)
|
157
166
|
message = format % loc_("person")
|
@@ -222,8 +231,8 @@ class TestValidation < Test::Unit::TestCase
|
|
222
231
|
assert(ou_class.new("YYY").save)
|
223
232
|
ou = ou_class.new("YYY")
|
224
233
|
assert(!ou.save)
|
225
|
-
format =
|
226
|
-
format <<
|
234
|
+
format = human_attribute_name("distinguishedName")
|
235
|
+
format << " " << _("is duplicated: %s")
|
227
236
|
message = format % ou.dn
|
228
237
|
assert_equal([message], ou.errors.full_messages)
|
229
238
|
end
|
@@ -259,12 +268,16 @@ class TestValidation < Test::Unit::TestCase
|
|
259
268
|
end
|
260
269
|
|
261
270
|
private
|
271
|
+
def human_attribute_name(name)
|
272
|
+
la_(name).dup
|
273
|
+
end
|
274
|
+
|
262
275
|
def assert_invalid_value(name, formatted_value, syntax, reason, model, option)
|
263
276
|
syntax_description = lsd_(syntax)
|
264
277
|
assert_not_nil(syntax_description)
|
265
278
|
params = [formatted_value, syntax_description, reason]
|
266
279
|
params.unshift(option) if option
|
267
|
-
localized_name =
|
280
|
+
localized_name = human_attribute_name(name)
|
268
281
|
format = localized_name << ' '
|
269
282
|
if option
|
270
283
|
format << _("(%s) has invalid format: %s: required syntax: %s: %s")
|
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:
|
4
|
+
version: 6.1.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:
|
12
|
+
date: 2020-12-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|
@@ -17,14 +17,14 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '5.2'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
27
|
+
version: '5.2'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: locale
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,7 +96,7 @@ dependencies:
|
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '0'
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
|
-
name:
|
99
|
+
name: kramdown
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
102
|
- - ">="
|
@@ -110,21 +110,7 @@ dependencies:
|
|
110
110
|
- !ruby/object:Gem::Version
|
111
111
|
version: '0'
|
112
112
|
- !ruby/object:Gem::Dependency
|
113
|
-
name:
|
114
|
-
requirement: !ruby/object:Gem::Requirement
|
115
|
-
requirements:
|
116
|
-
- - ">="
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
version: '0'
|
119
|
-
type: :development
|
120
|
-
prerelease: false
|
121
|
-
version_requirements: !ruby/object:Gem::Requirement
|
122
|
-
requirements:
|
123
|
-
- - ">="
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '0'
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
name: test-unit-notify
|
113
|
+
name: packnga
|
128
114
|
requirement: !ruby/object:Gem::Requirement
|
129
115
|
requirements:
|
130
116
|
- - ">="
|
@@ -138,7 +124,7 @@ dependencies:
|
|
138
124
|
- !ruby/object:Gem::Version
|
139
125
|
version: '0'
|
140
126
|
- !ruby/object:Gem::Dependency
|
141
|
-
name:
|
127
|
+
name: rake
|
142
128
|
requirement: !ruby/object:Gem::Requirement
|
143
129
|
requirements:
|
144
130
|
- - ">="
|
@@ -152,7 +138,7 @@ dependencies:
|
|
152
138
|
- !ruby/object:Gem::Version
|
153
139
|
version: '0'
|
154
140
|
- !ruby/object:Gem::Dependency
|
155
|
-
name:
|
141
|
+
name: test-unit
|
156
142
|
requirement: !ruby/object:Gem::Requirement
|
157
143
|
requirements:
|
158
144
|
- - ">="
|
@@ -166,7 +152,7 @@ dependencies:
|
|
166
152
|
- !ruby/object:Gem::Version
|
167
153
|
version: '0'
|
168
154
|
- !ruby/object:Gem::Dependency
|
169
|
-
name:
|
155
|
+
name: yard
|
170
156
|
requirement: !ruby/object:Gem::Requirement
|
171
157
|
requirements:
|
172
158
|
- - ">="
|
@@ -196,16 +182,15 @@ files:
|
|
196
182
|
- COPYING
|
197
183
|
- Gemfile
|
198
184
|
- LICENSE
|
199
|
-
- README.textile
|
200
185
|
- TODO
|
201
186
|
- benchmark/README.md
|
202
187
|
- benchmark/bench-backend.rb
|
203
188
|
- benchmark/bench-instantiate.rb
|
204
189
|
- benchmark/config.yaml.sample
|
205
|
-
- doc/text/development.
|
206
|
-
- doc/text/news.
|
207
|
-
- doc/text/rails.
|
208
|
-
- doc/text/tutorial.
|
190
|
+
- doc/text/development.md
|
191
|
+
- doc/text/news.md
|
192
|
+
- doc/text/rails.md
|
193
|
+
- doc/text/tutorial.md
|
209
194
|
- examples/config.yaml.example
|
210
195
|
- examples/example.der
|
211
196
|
- examples/example.jpg
|
@@ -294,6 +279,7 @@ files:
|
|
294
279
|
- test/al-test-utils.rb
|
295
280
|
- test/command.rb
|
296
281
|
- test/config.yaml.sample
|
282
|
+
- test/enable-dynamic-groups.ldif
|
297
283
|
- test/enable-start-tls.ldif
|
298
284
|
- test/fixtures/lower_case_object_class_schema.rb
|
299
285
|
- test/run-test.rb
|
@@ -359,8 +345,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
359
345
|
- !ruby/object:Gem::Version
|
360
346
|
version: '0'
|
361
347
|
requirements: []
|
362
|
-
|
363
|
-
rubygems_version: 2.7.6.2
|
348
|
+
rubygems_version: 3.2.0.rc.2
|
364
349
|
signing_key:
|
365
350
|
specification_version: 4
|
366
351
|
summary: ActiveLdap is a object-oriented API to LDAP
|
@@ -369,6 +354,7 @@ test_files:
|
|
369
354
|
- test/al-test-utils.rb
|
370
355
|
- test/command.rb
|
371
356
|
- test/config.yaml.sample
|
357
|
+
- test/enable-dynamic-groups.ldif
|
372
358
|
- test/enable-start-tls.ldif
|
373
359
|
- test/fixtures/lower_case_object_class_schema.rb
|
374
360
|
- test/run-test.rb
|
data/README.textile
DELETED
@@ -1,141 +0,0 @@
|
|
1
|
-
h1. ActiveLdap
|
2
|
-
|
3
|
-
A ruby library for object-oriented LDAP interface.
|
4
|
-
|
5
|
-
* Copyright (C) 2004-2006 Will Drewry _<will@alum.bu.edu>_
|
6
|
-
* Copyright (C) 2006-2013 Kouhei Sutou _<kou@clear-code.com>_
|
7
|
-
|
8
|
-
h2. Description
|
9
|
-
|
10
|
-
'ActiveLdap' is a ruby library which provides a clean
|
11
|
-
objected oriented interface to LDAP library. It was
|
12
|
-
inspired by ActiveRecord. This is not nearly as clean or as
|
13
|
-
flexible as ActiveRecord, but it is still trivial to define
|
14
|
-
new objects and manipulate them with minimal difficulty.
|
15
|
-
|
16
|
-
For example and usage - read the
|
17
|
-
"document":http://activeldap.github.io/.
|
18
|
-
|
19
|
-
h2. Prerequisites
|
20
|
-
|
21
|
-
- Ruby intepreter :=
|
22
|
-
One of them:
|
23
|
-
* "Ruby":http://www.ruby-lang.org (1.9.3, 2.0.x, 2.1.x, 2.2.x, 2.3.0)
|
24
|
-
* "JRuby":http://www.jruby.org/
|
25
|
-
|
26
|
-
See the above links for installation.
|
27
|
-
=:
|
28
|
-
- LDAP client :=
|
29
|
-
JRuby doesn't need to install new library because JRuby
|
30
|
-
has builtin LDAP support. Ruby users need one of them:
|
31
|
-
|
32
|
-
* "Ruby/LDAP":http://ruby-ldap.sourceforge.net/
|
33
|
-
* "Net::LDAP":http://rubyldap.com/
|
34
|
-
|
35
|
-
See the above links for installation.
|
36
|
-
=:
|
37
|
-
- ActiveModel :=
|
38
|
-
A toolkit for building modeling frameworks like Active
|
39
|
-
Record and Active Resource.
|
40
|
-
=:
|
41
|
-
|
42
|
-
h2. Notes
|
43
|
-
|
44
|
-
* Only GSSAPI SASL support exists due to Ruby/LDAP limitations
|
45
|
-
|
46
|
-
h2. Rails
|
47
|
-
|
48
|
-
See "Rails":file.rails.html ("doc/text/rails.textile":doc/text/rails.textile
|
49
|
-
in the repository and on GitHub) page for Rails integration.
|
50
|
-
|
51
|
-
h2. Licence
|
52
|
-
|
53
|
-
This program is free software; you can redistribute it and/or modify it. It is
|
54
|
-
dual licensed under Ruby's license and under the terms of the GNU General
|
55
|
-
Public License as published by the Free Software Foundation; either version 2,
|
56
|
-
or (at your option) any later version.
|
57
|
-
|
58
|
-
Please see the file LICENSE for the terms of the licence.
|
59
|
-
|
60
|
-
h2. Thanks
|
61
|
-
|
62
|
-
This list may not be correct. If you notice mistakes of this
|
63
|
-
list, please point out.
|
64
|
-
|
65
|
-
* Dick Davies
|
66
|
-
* Nathan Kinder
|
67
|
-
* Patrick Cole
|
68
|
-
* Google Inc.
|
69
|
-
* Nobody: Bug reports and API improveent ideas.
|
70
|
-
* James Hughes: Bug reports and advices and documentations.
|
71
|
-
* Buzz Chopra: Documentations.
|
72
|
-
* Christoph Lipp:
|
73
|
-
** Bug reports.
|
74
|
-
** Tell us character escape syntax.
|
75
|
-
* Jeff Hall: Bug reports.
|
76
|
-
* Ernie Miller: Bug reports and advices.
|
77
|
-
* Daniel Pfile: Patches.
|
78
|
-
* Jacob Wilkins: Bug reports.
|
79
|
-
* Ace Suares:
|
80
|
-
** Bug reports.
|
81
|
-
** Nederlands translations.
|
82
|
-
* Iain Pople: Bug reports and API improvement ideas.
|
83
|
-
* Kevin McCarthy: Patches.
|
84
|
-
* Perry Smith: Patches, bug reports and indications.
|
85
|
-
* Marc Dequènes: API suggestions.
|
86
|
-
* Jeremy Pruitt: Bug reports.
|
87
|
-
* Bodaniel Jeanes:
|
88
|
-
** A suggestion for behavior on simple bind with empty password.
|
89
|
-
** Bug reports.
|
90
|
-
* Naoto Morishima: Bug reports.
|
91
|
-
* David Morton:
|
92
|
-
** An API improvement idea.
|
93
|
-
** Bug reports.
|
94
|
-
* Lennon Day-Reynolds: Bug reports.
|
95
|
-
* Tilo: A bug report.
|
96
|
-
* Matt Mencel: Bug reports.
|
97
|
-
* CultureSpy:
|
98
|
-
** Bug reports.
|
99
|
-
** Bug fixes.
|
100
|
-
* gwarf12: A bug report.
|
101
|
-
* Baptiste Grenier: API improvement ideas.
|
102
|
-
* Richard 3 Nicholas: API improvement ideas.
|
103
|
-
* Kazuhiro NISHIYAMA: A bug report.
|
104
|
-
* Grzegorz Marszałek: A bug report.
|
105
|
-
* しまさわらさん: A suggesetion.
|
106
|
-
* Ted Lepich: A suggestion.
|
107
|
-
* danger1986: A suggestion.
|
108
|
-
* michael.j.konopka: Bug reports.
|
109
|
-
* ingersoll: A suggestion.
|
110
|
-
* Alexey.Chebotar: Bug reports.
|
111
|
-
* ery.lee: A bug report.
|
112
|
-
* id:dicdak: A bug report.
|
113
|
-
* Raiko Mitsu: A bug report.
|
114
|
-
* Kazuaki Takase: Documents in Japanese.
|
115
|
-
* Tim Hermans: A bug report.
|
116
|
-
* Joe Francis: A suggestion.
|
117
|
-
* Tiago Fernandes: Bug reports.
|
118
|
-
* achemze: A suggestion.
|
119
|
-
* George Montana Harkin: A suggestion.
|
120
|
-
* Marc Dequènes: Bug reports.
|
121
|
-
* brad@lucky-dip.net: A bug report.
|
122
|
-
* Hideyuki Yasuda: Bug reports.
|
123
|
-
* zachwily: A bug report.
|
124
|
-
* syrius.ml@no-log.org: A bug report.
|
125
|
-
* Tim Hermans: A bug report.
|
126
|
-
* Anthony M. Martinez: Helped SASL options support
|
127
|
-
* ilusi0n.x: A bug report.
|
128
|
-
* projekttabla: A suggestion.
|
129
|
-
* christian.pennaforte: A bug report.
|
130
|
-
* planetmcd: A bug report.
|
131
|
-
* spoidar: Rails 3 support.
|
132
|
-
* Kris Wehner: Rails 2.3.8 support.
|
133
|
-
* Ryan Tandy:
|
134
|
-
** A test bug fix.
|
135
|
-
** Rails 3 support.
|
136
|
-
* rbq: A bug report.
|
137
|
-
* Narihiro Nakamura: Rails 3 support.
|
138
|
-
* Hidetoshi Yoshimoto: Rails 3 support.
|
139
|
-
* warden: A bug report.
|
140
|
-
* bklier: A bug fix.
|
141
|
-
* Craig White: Bug reports.
|
@@ -1,54 +0,0 @@
|
|
1
|
-
h1. Development
|
2
|
-
|
3
|
-
Here is information for developers.
|
4
|
-
|
5
|
-
h2. Repository
|
6
|
-
|
7
|
-
ActiveLdap uses ["git repository on
|
8
|
-
GitHub":https://github.com/activeldap]. Here is a
|
9
|
-
list to get each source code.
|
10
|
-
|
11
|
-
- "activeldap":https://github.com/activeldap/activeldap :=
|
12
|
-
<pre class="command">
|
13
|
-
% git clone https://github.com/activeldap/activeldap.git
|
14
|
-
</pre>
|
15
|
-
=:
|
16
|
-
- "al-admin":https://github.com/activeldap/al-admin :=
|
17
|
-
<pre class="command">
|
18
|
-
% git clone https://github.com/activeldap/al-admin.git
|
19
|
-
</pre>
|
20
|
-
=:
|
21
|
-
|
22
|
-
h2. Issues
|
23
|
-
|
24
|
-
ActiveLdap uses "Issues on
|
25
|
-
GitHub":https://github.com/activeldap/activeldap/issues for
|
26
|
-
issue tracking. Please submit a issue when you find an
|
27
|
-
issue.
|
28
|
-
|
29
|
-
h2. Rails 3 support
|
30
|
-
|
31
|
-
Here is design about Rails 3 support.
|
32
|
-
|
33
|
-
h3. must
|
34
|
-
|
35
|
-
* We add active_ldap/test_help.rb to support ActiveLdap fixture.
|
36
|
-
We don't write same codes into test_helper.rb like
|
37
|
-
http://ruby-activeldap.rubyforge.org/activeldap-fabrication/en/#Install
|
38
|
-
|
39
|
-
h3. may
|
40
|
-
|
41
|
-
* We support Warden.
|
42
|
-
* We support Devise
|
43
|
-
* We support OmniAuth. (instead of Warden)
|
44
|
-
|
45
|
-
h3. DONE
|
46
|
-
|
47
|
-
* We don't support Rails 3.0.x.
|
48
|
-
* We provide active_ldap/railtie to initialize ActiveLdap.
|
49
|
-
* We remove ActiveRecord dependency.
|
50
|
-
* We depend on ActiveModel instead of ActiveRecord.
|
51
|
-
* We target to Rails 3.1.0. (Yes, it's not released yet
|
52
|
-
but it will be released before we support Rails 3.x.)
|
53
|
-
* We update the documentation and ensure that the procedure
|
54
|
-
for including ActiveLdap in a Rails 3 project is correct.
|