activeldap 7.2.1 → 7.2.2
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 +4 -4
- data/doc/text/news.md +44 -0
- data/doc/text/tutorial.md +82 -44
- data/lib/active_ldap/associations.rb +0 -22
- data/lib/active_ldap/base.rb +0 -25
- data/lib/active_ldap/callbacks.rb +0 -10
- data/lib/active_ldap/configuration.rb +2 -7
- data/lib/active_ldap/connection.rb +17 -24
- data/lib/active_ldap/operations.rb +0 -6
- data/lib/active_ldap/version.rb +1 -1
- data/po/en/active-ldap.po +0 -42
- data/po/ja/active-ldap.po +0 -55
- data/test/al-test-utils.rb +3 -0
- data/test/test_associations.rb +0 -17
- data/test/test_multi_configuration.rb +94 -0
- metadata +12 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7c3766a3d485894a01aa4b453efcb8e7e04de22c74052c0af83b15d85ee5923
|
4
|
+
data.tar.gz: b79b046dc24c0871b80826dd1bc04f266a56b89a78fc1e1f9f3d1306486b9722
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 576235f73ffb25c18048f603a634f80318185ae8698e48d34d03c17e01d40d616c1471ae353f251767254c09b2bc773549e56b35e1454e7101bfc0fd24477772
|
7
|
+
data.tar.gz: b296e277be6ce3e32c8b06db122794496d3f592aa6cb4a4ed942ac1470b22efc657dd952f8eeabe99b959cf8ec285b7f198a3e434aea9f8cc30ffc778822635a
|
data/doc/text/news.md
CHANGED
@@ -1,5 +1,49 @@
|
|
1
1
|
# News
|
2
2
|
|
3
|
+
## 7.2.2: 2025-06-08 {#release-7-2-2}
|
4
|
+
|
5
|
+
### Improvements
|
6
|
+
|
7
|
+
* Removed deprecated `:primary_key` and `:foreign_key` on
|
8
|
+
`has_many`.
|
9
|
+
* GH-205
|
10
|
+
* GH-206
|
11
|
+
* Patch by J-Verz
|
12
|
+
|
13
|
+
* Removed deprecated `ActiveLdap::ConnectionNotEstabilished`.
|
14
|
+
* GH-205
|
15
|
+
* GH-207
|
16
|
+
* Patch by J-Verz
|
17
|
+
|
18
|
+
* Removed deprecated `estabilish_connection`.
|
19
|
+
* GH-205
|
20
|
+
* GH-208
|
21
|
+
* Patch by J-Verz
|
22
|
+
|
23
|
+
* Removed deprecated `:ldap_scope` configuration option.
|
24
|
+
* GH-205
|
25
|
+
* GH-209
|
26
|
+
* Patch by J-Verz
|
27
|
+
|
28
|
+
* Removed deprecated callback by instance methods on instances.
|
29
|
+
* GH-205
|
30
|
+
* GH-210
|
31
|
+
* Patch by J-Verz
|
32
|
+
|
33
|
+
* Removed deprecated `:foreign_key` on `belongs_to :many`.
|
34
|
+
* GH-205
|
35
|
+
* GH-211
|
36
|
+
* Patch by J-Verz
|
37
|
+
|
38
|
+
* Added support for multiple server configurations.
|
39
|
+
* GH-204
|
40
|
+
* GH-212
|
41
|
+
* Patch by J-Verz
|
42
|
+
|
43
|
+
### Thanks
|
44
|
+
|
45
|
+
* J-Verz
|
46
|
+
|
3
47
|
## 7.2.1: 2024-10-02 {#release-7-2-1}
|
4
48
|
|
5
49
|
### Fixes
|
data/doc/text/tutorial.md
CHANGED
@@ -210,19 +210,19 @@ case, it would be 'ou=Groups'.
|
|
210
210
|
|
211
211
|
This method allows an extension class to make use of other extension classes
|
212
212
|
tying objects together across the LDAP tree. Often, user objects will be
|
213
|
-
members of, or
|
213
|
+
members of, or belong to, `Group` objects.
|
214
214
|
|
215
215
|
```text
|
216
216
|
* dc=dataspill,dc=org
|
217
217
|
|+ ou=People,dc=dataspill,dc=org
|
218
|
-
|
218
|
+
\
|
219
219
|
|- uid=drewry,ou=People,dc=dataspill,dc=org
|
220
|
-
|- ou=Groups,dc=dataspill,dc=org
|
220
|
+
|- ou=Groups,dc=dataspill,dc=org
|
221
221
|
```
|
222
222
|
|
223
|
-
|
224
|
-
|
225
|
-
|
223
|
+
In the above tree, one such example would be user `drewry` who is a
|
224
|
+
part of the group `develop`. You can see this by looking at the
|
225
|
+
`memberUid` field of `develop`.
|
226
226
|
|
227
227
|
```text
|
228
228
|
irb> develop = Group.find('develop')
|
@@ -231,18 +231,19 @@ irb> develop.memberUid
|
|
231
231
|
=> ['drewry', 'builder']
|
232
232
|
```
|
233
233
|
|
234
|
-
If we look at the LDAP entry for
|
235
|
-
group
|
234
|
+
If we look at the LDAP entry for `drewry`, we do not see any
|
235
|
+
references to group `develop`. In order to remedy that, we can use
|
236
|
+
`belongs_to`:
|
236
237
|
|
237
238
|
```text
|
238
239
|
irb> class User < ActiveLdap::Base
|
239
240
|
irb* ldap_mapping :dn_attribute => 'uid', :prefix => 'ou=People', :classes => ['top','account']
|
240
|
-
irb* belongs_to :groups, :class_name => 'Group', :many => 'memberUid', :
|
241
|
+
irb* belongs_to :groups, :class_name => 'Group', :many => 'memberUid', :primary_key => 'uid'
|
241
242
|
irb* end
|
242
243
|
```
|
243
244
|
|
244
|
-
Now, class User will have a method called
|
245
|
-
Group objects that a user is in.
|
245
|
+
Now, class `User` will have a method called `groups` which will
|
246
|
+
retrieve all `Group` objects that a user is in.
|
246
247
|
|
247
248
|
```text
|
248
249
|
irb> me = User.find('drewry')
|
@@ -256,8 +257,8 @@ irb> me.groups.each { |group| p group.cn };nil
|
|
256
257
|
(Note: nil is just there to make the output cleaner...)
|
257
258
|
```
|
258
259
|
|
259
|
-
TIP: If you weren't sure what the distinguished name attribute was for
|
260
|
-
you could also do the following:
|
260
|
+
TIP: If you weren't sure what the distinguished name attribute was for
|
261
|
+
`Group`, you could also do the following:
|
261
262
|
|
262
263
|
```text
|
263
264
|
irb> me.groups.each { |group| p group.id };nil
|
@@ -267,47 +268,58 @@ irb> me.groups.each { |group| p group.id };nil
|
|
267
268
|
=> nil
|
268
269
|
```
|
269
270
|
|
270
|
-
Now let's talk about the arguments of belongs_to
|
271
|
+
Now let's talk about the arguments of `belongs_to`. We use the
|
272
|
+
following code that extends `User` a bit:
|
271
273
|
|
272
274
|
```ruby
|
273
275
|
class User < ActiveLdap::Base
|
274
276
|
ldap_mapping :dn_attribute => 'uid', :prefix => 'People', :classes => ['top','account']
|
275
277
|
|
278
|
+
# Associate with all belonged groups
|
279
|
+
belongs_to :groups, :primary_key => 'uid',
|
280
|
+
:class_name => 'Group', :many => 'memberUid'
|
281
|
+
|
276
282
|
# Associate with primary belonged group
|
277
283
|
belongs_to :primary_group, :foreign_key => 'gidNumber',
|
278
|
-
|
279
|
-
|
280
|
-
# Associate with all belonged groups
|
281
|
-
belongs_to :groups, :foreign_key => 'uid',
|
282
|
-
:class_name => 'Group', :many => 'memberUid',
|
284
|
+
:class_name => 'Group', :primary_key => 'gidNumber'
|
283
285
|
end
|
284
286
|
```
|
285
287
|
|
286
|
-
The first argument is the name of the method you wish to create. In
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
`:
|
309
|
-
|
310
|
-
|
288
|
+
The first argument is the name of the method you wish to create. In
|
289
|
+
this case, we created a method called `groups` and `primary_group`
|
290
|
+
using the symbols `:groups` and `:primary_group`. The next collection
|
291
|
+
of arguments are actually a `Hash` (as with `ldap_mapping`).
|
292
|
+
|
293
|
+
To specify the `groups` association, we use the `:many` option.
|
294
|
+
`:many` is used if an object belongs to many objects. All of matched
|
295
|
+
objects are treated as belonged objects. `:many` sets the "related object's
|
296
|
+
attribute name" and `:primary_key` sets the "own attribute name".
|
297
|
+
If `:primary_key` is left off of the argument list, it is assumed to be the
|
298
|
+
`dn_attribute`. In the example, `uid` is specified explicitly but we
|
299
|
+
can omit it because `uid` is the default value.
|
300
|
+
|
301
|
+
Relation is resolved by searching entries of `:class_name` class
|
302
|
+
objects with `:many` attribute value. Search target attribute for it
|
303
|
+
is `:primary_key`. The `groups` method in the above example searches
|
304
|
+
`Group` objects with `User` object's `uid` value as `Group` object's
|
305
|
+
`memberUid` value.
|
306
|
+
|
307
|
+
|
308
|
+
When an object just belongs to an object, `:foreign_key` is used
|
309
|
+
instead of `:many` and the attributes swap meaning:
|
310
|
+
`:primary_key` specifies the "related object's attribute name" while
|
311
|
+
`:foreign_key` specifies the "own attribute name".
|
312
|
+
|
313
|
+
Relation is resolved by searching entries of `:class_name` class
|
314
|
+
objects with `:primary_key` attribute value. Search target attribute
|
315
|
+
for it is `:foreign_key`. The first matched object is treated as
|
316
|
+
the belonged object. The `primary_group` method in the above
|
317
|
+
example searches `Group` objects with `User` object's `gidNumber`
|
318
|
+
value as `Group` object's `gidNumber` value.
|
319
|
+
|
320
|
+
`:class_name` should be a string that has the name of a class you've
|
321
|
+
already included. If your class is inside of a module, be sure to put
|
322
|
+
the whole name, e.g. `:class_name => "MyLdapModule::Group"`.
|
311
323
|
|
312
324
|
##### `has_many`
|
313
325
|
|
@@ -932,6 +944,32 @@ irb> auth_class.setup_connection(:password_block => lambda{'mypass'})
|
|
932
944
|
|
933
945
|
This can be useful for doing authentication tests and other such tricks.
|
934
946
|
|
947
|
+
#### Connecting to multiple different servers simultaneously
|
948
|
+
If you use a YAML configuration file, you can also define multiple configurations there and reference them by name. Let's say that your configuration file contains the following:
|
949
|
+
```yaml
|
950
|
+
primary:
|
951
|
+
host: ldap.example.com
|
952
|
+
base: dc=primary,dc=com
|
953
|
+
bind_dn: cn=admin,dc=primary,dc=com
|
954
|
+
my_server:
|
955
|
+
host: ldap.example.com
|
956
|
+
base: dc=example,dc=com
|
957
|
+
bind_dn: cn=admin,dc=example,dc=com
|
958
|
+
password: justanexample
|
959
|
+
external_server:
|
960
|
+
host: ldap.external.com
|
961
|
+
base: dc=external,dc=com
|
962
|
+
bind_dn: cn=someone,dc=external,dc=com
|
963
|
+
password: thisisanexample
|
964
|
+
```
|
965
|
+
|
966
|
+
By passing a keyword argument named `:name` to `setup_connection` you can choose which configuration a certain class should use. When you don't specify a name while multiple configurations exist, the name `primary` is used.
|
967
|
+
```ruby
|
968
|
+
MyUser.setup_connection(:name => :my_server)
|
969
|
+
ExternalUser.setup_connection(:name => :external_server)
|
970
|
+
User.setup_connection # will use the configuration under 'primary'
|
971
|
+
```
|
972
|
+
|
935
973
|
#### :try_sasl
|
936
974
|
|
937
975
|
If you have the Ruby/LDAP package with the SASL/GSSAPI patch from Ian
|
@@ -38,8 +38,6 @@ module ActiveLdap
|
|
38
38
|
# belongs_to :groups, :class_name => "Group",
|
39
39
|
# :many => "memberUid" # Group#memberUid
|
40
40
|
# # :primary_key => "uid" # User#uid
|
41
|
-
# ## deprecated since 1.1.0. Use :primary_key instead.
|
42
|
-
# ## :foreign_key => "uid" # User#uid
|
43
41
|
# # dn attribute value is used by default
|
44
42
|
# belongs_to :primary_group, :class_name => "Group",
|
45
43
|
# :foreign_key => "gidNumber", # User#gidNumber
|
@@ -63,13 +61,6 @@ module ActiveLdap
|
|
63
61
|
}
|
64
62
|
if opts[:many]
|
65
63
|
association_class = Association::BelongsToMany
|
66
|
-
foreign_key_name = opts[:foreign_key_name]
|
67
|
-
if foreign_key_name
|
68
|
-
message = _(":foreign_key belongs_to(:many) option is " \
|
69
|
-
"deprecated since 1.1.0. Use :primary_key instead.")
|
70
|
-
ActiveLdap.deprecator.warn(message)
|
71
|
-
opts[:primary_key_name] ||= foreign_key_name
|
72
|
-
end
|
73
64
|
opts[:primary_key_name] ||= dn_attribute
|
74
65
|
else
|
75
66
|
association_class = Association::BelongsTo
|
@@ -103,10 +94,6 @@ module ActiveLdap
|
|
103
94
|
# has_many :primary_members, :class_name => "User",
|
104
95
|
# :primary_key => "gidNumber", # Group#gidNumber
|
105
96
|
# :foreign_key => "gidNumber" # User#gidNumber
|
106
|
-
# ## deprecated since 1.1.0. Those options
|
107
|
-
# ## are inverted.
|
108
|
-
# # :primary_key => "gidNumber", # User#gidNumber
|
109
|
-
# # :foreign_key => "gidNumber" # Group#gidNumber
|
110
97
|
# has_many :members, :class_name => "User",
|
111
98
|
# :wrap => "memberUid" # Group#memberUid
|
112
99
|
def has_many(association_id, options = {})
|
@@ -130,15 +117,6 @@ module ActiveLdap
|
|
130
117
|
association_class = Association::HasMany
|
131
118
|
primary_key_name = opts[:primary_key_name]
|
132
119
|
foreign_key_name = opts[:foreign_key_name]
|
133
|
-
if primary_key_name != foreign_key_name and
|
134
|
-
primary_key_name != "dn" and
|
135
|
-
!new.have_attribute?(primary_key_name)
|
136
|
-
message = _(":primary_key and :foreign_key has_many options are " \
|
137
|
-
"inverted their mean since 1.1.0. Please invert them.")
|
138
|
-
ActiveLdap.deprecator.warn(message)
|
139
|
-
opts[:foreign_key_name] = primary_key_name
|
140
|
-
opts[:primary_key_name] = foreign_key_name
|
141
|
-
end
|
142
120
|
end
|
143
121
|
|
144
122
|
association_accessor(association_id) do |target|
|
data/lib/active_ldap/base.rb
CHANGED
@@ -48,20 +48,6 @@ module ActiveLdap
|
|
48
48
|
|
49
49
|
class << self
|
50
50
|
include GetTextSupport
|
51
|
-
def const_missing(id)
|
52
|
-
case id
|
53
|
-
when :ConnectionNotEstablished
|
54
|
-
message =
|
55
|
-
_("ActiveLdap::ConnectionNotEstablished has been deprecated " \
|
56
|
-
"since 1.1.0. " \
|
57
|
-
"Please use ActiveLdap::ConnectionNotSetup instead.")
|
58
|
-
ActiveLdap.deprecator.warn(message)
|
59
|
-
const_set("ConnectionNotEstablished", ConnectionNotSetup)
|
60
|
-
ConnectionNotEstablished
|
61
|
-
else
|
62
|
-
super
|
63
|
-
end
|
64
|
-
end
|
65
51
|
end
|
66
52
|
|
67
53
|
class Error < StandardError
|
@@ -384,17 +370,6 @@ module ActiveLdap
|
|
384
370
|
nil
|
385
371
|
end
|
386
372
|
|
387
|
-
# establish_connection is deprecated since 1.1.0. Please use
|
388
|
-
# setup_connection() instead.
|
389
|
-
def establish_connection(config=nil)
|
390
|
-
message =
|
391
|
-
_("ActiveLdap::Base.establish_connection has been deprecated " \
|
392
|
-
"since 1.1.0. " \
|
393
|
-
"Please use ActiveLdap::Base.setup_connection instead.")
|
394
|
-
ActiveLdap.deprecator.warn(message)
|
395
|
-
setup_connection(config)
|
396
|
-
end
|
397
|
-
|
398
373
|
def create(attributes=nil, &block)
|
399
374
|
if attributes.is_a?(Array)
|
400
375
|
attributes.collect {|attrs| create(attrs, &block)}
|
@@ -22,16 +22,6 @@ module ActiveLdap
|
|
22
22
|
define_model_callbacks :save, :create, :update, :destroy
|
23
23
|
end
|
24
24
|
|
25
|
-
module ClassMethods
|
26
|
-
def method_added(meth)
|
27
|
-
super
|
28
|
-
if CALLBACKS.include?(meth.to_sym)
|
29
|
-
ActiveLdap.deprecator.warn("Base##{meth} has been deprecated, please use Base.#{meth} :method instead", caller[0,1])
|
30
|
-
send(meth.to_sym, meth.to_sym)
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
25
|
module CallbackedInstantiatable
|
36
26
|
def instantiate(record)
|
37
27
|
object = super(record)
|
@@ -73,7 +73,7 @@ module ActiveLdap
|
|
73
73
|
elsif defined?(Rails)
|
74
74
|
config = Rails.env
|
75
75
|
else
|
76
|
-
config =
|
76
|
+
config = configurations
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
@@ -133,12 +133,7 @@ module ActiveLdap
|
|
133
133
|
when :base
|
134
134
|
# Scrub before inserting
|
135
135
|
target.base = value.gsub(/['}{#]/, '')
|
136
|
-
when :scope
|
137
|
-
if key == :ldap_scope
|
138
|
-
message = _(":ldap_scope configuration option is deprecated. " \
|
139
|
-
"Use :scope instead.")
|
140
|
-
ActiveLdap.deprecator.warn(message)
|
141
|
-
end
|
136
|
+
when :scope
|
142
137
|
target.scope = value
|
143
138
|
configuration[:scope] = value
|
144
139
|
else
|
@@ -94,12 +94,6 @@ module ActiveLdap
|
|
94
94
|
unless Adapter::Base.respond_to?(adapter_method)
|
95
95
|
raise AdapterNotFound.new(adapter)
|
96
96
|
end
|
97
|
-
if config.has_key?(:ldap_scope)
|
98
|
-
message = _(":ldap_scope connection option is deprecated. " \
|
99
|
-
"Use :scope instead.")
|
100
|
-
ActiveLdap.deprecator.warn(message)
|
101
|
-
config[:scope] ||= config.delete(:ldap_scope)
|
102
|
-
end
|
103
97
|
config = remove_connection_related_configuration(config)
|
104
98
|
Adapter::Base.send(adapter_method, config)
|
105
99
|
end
|
@@ -142,7 +136,24 @@ module ActiveLdap
|
|
142
136
|
end
|
143
137
|
|
144
138
|
def setup_connection(config=nil)
|
139
|
+
if config.is_a?(Hash) and config.size == 1 and config.key? :name
|
140
|
+
name = config[:name]
|
141
|
+
config = nil
|
142
|
+
else
|
143
|
+
name = nil
|
144
|
+
end
|
145
|
+
|
145
146
|
config = ensure_configuration(config)
|
147
|
+
if name
|
148
|
+
config = config[name.to_s]
|
149
|
+
elsif config.is_a?(Hash) and config.values.all?(Hash)
|
150
|
+
config = config["primary"] || config.values.first
|
151
|
+
end
|
152
|
+
|
153
|
+
unless config
|
154
|
+
raise ConnectionError, _("%s connection is not configured") % (name || "primary")
|
155
|
+
end
|
156
|
+
|
146
157
|
remove_connection
|
147
158
|
|
148
159
|
clear_active_connection_name
|
@@ -151,15 +162,6 @@ module ActiveLdap
|
|
151
162
|
define_configuration(key, merge_configuration(config))
|
152
163
|
end
|
153
164
|
|
154
|
-
def establish_connection(config=nil)
|
155
|
-
message =
|
156
|
-
_("ActiveLdap::Connection.establish_connection has been deprecated " \
|
157
|
-
"since 1.1.0. " \
|
158
|
-
"Please use ActiveLdap::Connection.setup_connection instead.")
|
159
|
-
ActiveLdap.deprecator.warn(message)
|
160
|
-
setup_connection(config)
|
161
|
-
end
|
162
|
-
|
163
165
|
# Return the schema object
|
164
166
|
def schema
|
165
167
|
connection.schema
|
@@ -211,15 +213,6 @@ module ActiveLdap
|
|
211
213
|
self.class.define_configuration(dn, config)
|
212
214
|
end
|
213
215
|
|
214
|
-
def establish_connection(config=nil)
|
215
|
-
message =
|
216
|
-
_("ActiveLdap::Connection#establish_connection has been deprecated " \
|
217
|
-
"since 1.1.0. " \
|
218
|
-
"Please use ActiveLdap::Connection#setup_connection instead.")
|
219
|
-
ActiveLdap.deprecator.warn(message)
|
220
|
-
setup_connection(config)
|
221
|
-
end
|
222
|
-
|
223
216
|
def remove_connection
|
224
217
|
self.class.remove_connection(dn)
|
225
218
|
@connection = nil
|
@@ -62,12 +62,6 @@ module ActiveLdap
|
|
62
62
|
filter = [:and, filter, *object_class_filters(classes)]
|
63
63
|
_base = options[:base] ? [options[:base]] : [prefix, base]
|
64
64
|
_base = prepare_search_base(_base)
|
65
|
-
if options.has_key?(:ldap_scope)
|
66
|
-
message = _(":ldap_scope search option is deprecated. " \
|
67
|
-
"Use :scope instead.")
|
68
|
-
ActiveLdap.deprecator.warn(message)
|
69
|
-
options[:scope] ||= options[:ldap_scope]
|
70
|
-
end
|
71
65
|
search_options = {
|
72
66
|
:base => _base,
|
73
67
|
:scope => options[:scope] || scope,
|
data/lib/active_ldap/version.rb
CHANGED
data/po/en/active-ldap.po
CHANGED
@@ -3537,10 +3537,6 @@ msgstr ""
|
|
3537
3537
|
msgid "parent must be an entry or parent DN: %s"
|
3538
3538
|
msgstr ""
|
3539
3539
|
|
3540
|
-
#: lib/active_ldap/operations.rb:49
|
3541
|
-
msgid ":ldap_scope search option is deprecated. Use :scope instead."
|
3542
|
-
msgstr ""
|
3543
|
-
|
3544
3540
|
#: lib/active_ldap/operations.rb:258
|
3545
3541
|
msgid "Invalid order: %s"
|
3546
3542
|
msgstr ""
|
@@ -3569,18 +3565,6 @@ msgstr ""
|
|
3569
3565
|
msgid "Failed to delete LDAP entry: <%s>: %s"
|
3570
3566
|
msgstr ""
|
3571
3567
|
|
3572
|
-
#: lib/active_ldap/associations.rb:68
|
3573
|
-
msgid ""
|
3574
|
-
":foreign_key belongs_to(:many) option is deprecated since 1.1.0. Use :"
|
3575
|
-
"primary_key instead."
|
3576
|
-
msgstr ""
|
3577
|
-
|
3578
|
-
#: lib/active_ldap/associations.rb:136
|
3579
|
-
msgid ""
|
3580
|
-
":primary_key and :foreign_key has_many options are inverted their mean since "
|
3581
|
-
"1.1.0. Please invert them."
|
3582
|
-
msgstr ""
|
3583
|
-
|
3584
3568
|
#: lib/active_ldap/ldif.rb:396
|
3585
3569
|
msgid "version spec is missing"
|
3586
3570
|
msgstr ""
|
@@ -3763,12 +3747,6 @@ msgstr ""
|
|
3763
3747
|
msgid "Show version"
|
3764
3748
|
msgstr ""
|
3765
3749
|
|
3766
|
-
#: lib/active_ldap/base.rb:53
|
3767
|
-
msgid ""
|
3768
|
-
"ActiveLdap::ConnectionNotEstablished has been deprecated since 1.1.0. Please "
|
3769
|
-
"use ActiveLdap::ConnectionNotSetup instead."
|
3770
|
-
msgstr ""
|
3771
|
-
|
3772
3750
|
#: lib/active_ldap/base.rb:131
|
3773
3751
|
msgid "invalid distinguished name (DN) to parse: %s"
|
3774
3752
|
msgstr ""
|
@@ -3801,12 +3779,6 @@ msgstr ""
|
|
3801
3779
|
msgid "not implemented: %s"
|
3802
3780
|
msgstr ""
|
3803
3781
|
|
3804
|
-
#: lib/active_ldap/base.rb:382
|
3805
|
-
msgid ""
|
3806
|
-
"ActiveLdap::Base.establish_connection has been deprecated since 1.1.0. "
|
3807
|
-
"Please use ActiveLdap::Base.setup_connection instead."
|
3808
|
-
msgstr ""
|
3809
|
-
|
3810
3782
|
#: lib/active_ldap/base.rb:463
|
3811
3783
|
msgid "scope '%s' must be a Symbol"
|
3812
3784
|
msgstr ""
|
@@ -3853,16 +3825,6 @@ msgstr ""
|
|
3853
3825
|
msgid "Attribute %s: Hash must have one key-value pair only: %s"
|
3854
3826
|
msgstr ""
|
3855
3827
|
|
3856
|
-
#: lib/active_ldap/connection.rb:98
|
3857
|
-
msgid ":ldap_scope connection option is deprecated. Use :scope instead."
|
3858
|
-
msgstr ""
|
3859
|
-
|
3860
|
-
#: lib/active_ldap/connection.rb:156
|
3861
|
-
msgid ""
|
3862
|
-
"ActiveLdap::Connection.establish_connection has been deprecated since 1.1.0. "
|
3863
|
-
"Please use ActiveLdap::Connection.setup_connection instead."
|
3864
|
-
msgstr ""
|
3865
|
-
|
3866
3828
|
#: lib/active_ldap/connection.rb:236
|
3867
3829
|
msgid "since 1.1.0. "
|
3868
3830
|
msgstr ""
|
@@ -3965,10 +3927,6 @@ msgstr ""
|
|
3965
3927
|
msgid "%s connection is not configured"
|
3966
3928
|
msgstr ""
|
3967
3929
|
|
3968
|
-
#: lib/active_ldap/configuration.rb:110
|
3969
|
-
msgid ":ldap_scope configuration option is deprecated. Use :scope instead."
|
3970
|
-
msgstr ""
|
3971
|
-
|
3972
3930
|
#: lib/active_ldap/configuration.rb:131
|
3973
3931
|
msgid "invalid URI: %s"
|
3974
3932
|
msgstr ""
|
data/po/ja/active-ldap.po
CHANGED
@@ -3549,11 +3549,6 @@ msgstr "LDAPサーバへの再接続を諦めました。"
|
|
3549
3549
|
msgid "parent must be an entry or parent DN: %s"
|
3550
3550
|
msgstr "親はエントリかDNでなければいけません: %s"
|
3551
3551
|
|
3552
|
-
#: lib/active_ldap/operations.rb:49
|
3553
|
-
msgid ":ldap_scope search option is deprecated. Use :scope instead."
|
3554
|
-
msgstr ""
|
3555
|
-
":ldap_search検索オプションは廃止予定です。代わりに:scopeを使ってください。"
|
3556
|
-
|
3557
3552
|
#: lib/active_ldap/operations.rb:258
|
3558
3553
|
msgid "Invalid order: %s"
|
3559
3554
|
msgstr "不正な順序です: %s"
|
@@ -3582,22 +3577,6 @@ msgstr "すべての%sを見つけられませんでした: DN (%s)"
|
|
3582
3577
|
msgid "Failed to delete LDAP entry: <%s>: %s"
|
3583
3578
|
msgstr "LDAPエントリの削除に失敗しました: <%s>: %s"
|
3584
3579
|
|
3585
|
-
#: lib/active_ldap/associations.rb:68
|
3586
|
-
msgid ""
|
3587
|
-
":foreign_key belongs_to(:many) option is deprecated since 1.1.0. Use :"
|
3588
|
-
"primary_key instead."
|
3589
|
-
msgstr ""
|
3590
|
-
"1.1.0からbelongs_to(:many)の:foreign_keyオプションは非推奨になりました。代わ"
|
3591
|
-
"りに:primary_keyを使ってください。"
|
3592
|
-
|
3593
|
-
#: lib/active_ldap/associations.rb:136
|
3594
|
-
msgid ""
|
3595
|
-
":primary_key and :foreign_key has_many options are inverted their mean since "
|
3596
|
-
"1.1.0. Please invert them."
|
3597
|
-
msgstr ""
|
3598
|
-
"1.1.0からhas_manyの:primary_keyと:foreign_keyオプションの意味が反対になりまし"
|
3599
|
-
"た。オプションの値を入れかえてください。"
|
3600
|
-
|
3601
3580
|
#: lib/active_ldap/ldif.rb:396
|
3602
3581
|
msgid "version spec is missing"
|
3603
3582
|
msgstr "バージョン指定がありません"
|
@@ -3780,14 +3759,6 @@ msgstr "このメッセージを表示します"
|
|
3780
3759
|
msgid "Show version"
|
3781
3760
|
msgstr "バージョンを表示します"
|
3782
3761
|
|
3783
|
-
#: lib/active_ldap/base.rb:53
|
3784
|
-
msgid ""
|
3785
|
-
"ActiveLdap::ConnectionNotEstablished has been deprecated since 1.1.0. Please "
|
3786
|
-
"use ActiveLdap::ConnectionNotSetup instead."
|
3787
|
-
msgstr ""
|
3788
|
-
"1.1.0からActiveLdap::ConnectionNotEstablishedは非推奨になりました。代わりに"
|
3789
|
-
"ActiveLdap::ConnectionNotSetupを使ってください。"
|
3790
|
-
|
3791
3762
|
#: lib/active_ldap/base.rb:131
|
3792
3763
|
msgid "invalid distinguished name (DN) to parse: %s"
|
3793
3764
|
msgstr "構文解析できない不正な識別名(DN)です: %s"
|
@@ -3820,14 +3791,6 @@ msgstr "%sは未知の属性です"
|
|
3820
3791
|
msgid "not implemented: %s"
|
3821
3792
|
msgstr "未実装です: %s"
|
3822
3793
|
|
3823
|
-
#: lib/active_ldap/base.rb:382
|
3824
|
-
msgid ""
|
3825
|
-
"ActiveLdap::Base.establish_connection has been deprecated since 1.1.0. "
|
3826
|
-
"Please use ActiveLdap::Base.setup_connection instead."
|
3827
|
-
msgstr ""
|
3828
|
-
"1.1.0からActiveLdap::Base.establish_connectionは非推奨になりました。代わりに"
|
3829
|
-
"ActiveLdap::Base.setup_connectionを使ってください。"
|
3830
|
-
|
3831
3794
|
#: lib/active_ldap/base.rb:463
|
3832
3795
|
msgid "scope '%s' must be a Symbol"
|
3833
3796
|
msgstr "スコープ'%s'はシンボルでなければいけません"
|
@@ -3878,19 +3841,6 @@ msgstr "属性%sは単一の値しか持てません: %s"
|
|
3878
3841
|
msgid "Attribute %s: Hash must have one key-value pair only: %s"
|
3879
3842
|
msgstr "属性 %s: ハッシュはひとつのキー・値のペアしか持ってはいけません: %s"
|
3880
3843
|
|
3881
|
-
#: lib/active_ldap/connection.rb:98
|
3882
|
-
msgid ":ldap_scope connection option is deprecated. Use :scope instead."
|
3883
|
-
msgstr ""
|
3884
|
-
":ldap_scope接続オプションは廃止予定です。代わりに:scopeを使ってください。"
|
3885
|
-
|
3886
|
-
#: lib/active_ldap/connection.rb:156
|
3887
|
-
msgid ""
|
3888
|
-
"ActiveLdap::Connection.establish_connection has been deprecated since 1.1.0. "
|
3889
|
-
"Please use ActiveLdap::Connection.setup_connection instead."
|
3890
|
-
msgstr ""
|
3891
|
-
"1.1.0からActiveLdap::Connection.establish_connectionは非推奨になりました。代"
|
3892
|
-
"わりにActiveLdap::Connection.setup_connectionを使ってください。"
|
3893
|
-
|
3894
3844
|
#: lib/active_ldap/connection.rb:236
|
3895
3845
|
msgid "since 1.1.0. "
|
3896
3846
|
msgstr "1.1.0から。"
|
@@ -3993,11 +3943,6 @@ msgstr "'%{file}'を無視します。まず依存関係を解決してくださ
|
|
3993
3943
|
msgid "%s connection is not configured"
|
3994
3944
|
msgstr "%sの接続は設定されていません"
|
3995
3945
|
|
3996
|
-
#: lib/active_ldap/configuration.rb:110
|
3997
|
-
msgid ":ldap_scope configuration option is deprecated. Use :scope instead."
|
3998
|
-
msgstr ""
|
3999
|
-
":ldap_scope設定オプションは廃止予定です。代わりに:scopeを使ってください。"
|
4000
|
-
|
4001
3946
|
#: lib/active_ldap/configuration.rb:131
|
4002
3947
|
msgid "invalid URI: %s"
|
4003
3948
|
msgstr "不正なURIです: %s"
|
data/test/al-test-utils.rb
CHANGED
@@ -159,9 +159,11 @@ module AlTestUtils
|
|
159
159
|
module Populate
|
160
160
|
def setup
|
161
161
|
@dumped_data = nil
|
162
|
+
@configurations_on_dump = nil
|
162
163
|
super
|
163
164
|
begin
|
164
165
|
@dumped_data = ActiveLdap::Base.dump(:scope => :sub)
|
166
|
+
@configurations_on_dump = ActiveLdap::Base.configurations.dup
|
165
167
|
rescue ActiveLdap::ConnectionError
|
166
168
|
end
|
167
169
|
ActiveLdap::Base.delete_all(nil, :scope => :sub)
|
@@ -170,6 +172,7 @@ module AlTestUtils
|
|
170
172
|
|
171
173
|
def teardown
|
172
174
|
if @dumped_data
|
175
|
+
ActiveLdap::Base.configurations = @configurations_on_dump
|
173
176
|
ActiveLdap::Base.setup_connection
|
174
177
|
ActiveLdap::Base.delete_all(nil, :scope => :sub)
|
175
178
|
ActiveLdap::Base.load(@dumped_data)
|
data/test/test_associations.rb
CHANGED
@@ -133,23 +133,6 @@ EOX
|
|
133
133
|
end
|
134
134
|
end
|
135
135
|
|
136
|
-
def test_belongs_to_foreign_key_before_1_1_0
|
137
|
-
ActiveLdap.deprecator.silence do
|
138
|
-
@group_class.belongs_to :related_users, :many => "seeAlso",
|
139
|
-
:foreign_key => "dn"
|
140
|
-
end
|
141
|
-
@group_class.set_associated_class(:related_users, @user_class)
|
142
|
-
make_temporary_user do |user,|
|
143
|
-
make_temporary_group do |group|
|
144
|
-
user.see_also = group.dn
|
145
|
-
user.save!
|
146
|
-
|
147
|
-
group = @group_class.find(group.id)
|
148
|
-
assert_equal([user.dn], group.related_users.collect(&:dn))
|
149
|
-
end
|
150
|
-
end
|
151
|
-
end
|
152
|
-
|
153
136
|
def test_has_many_wrap_with_nonexistent_entry
|
154
137
|
@user_class.has_many :references, :wrap => "seeAlso", :primary_key => "dn"
|
155
138
|
@user_class.set_associated_class(:references, @group_class)
|
@@ -0,0 +1,94 @@
|
|
1
|
+
require 'al-test-utils'
|
2
|
+
|
3
|
+
class TestMultiConfiguration < Test::Unit::TestCase
|
4
|
+
include AlTestUtils
|
5
|
+
|
6
|
+
def test_configuration_with_no_key
|
7
|
+
assert do
|
8
|
+
connect(ActiveLdap::Base)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_configuration_with_primary_key
|
13
|
+
ActiveLdap::Base.configurations[LDAP_ENV] = {
|
14
|
+
"primary" => current_configuration
|
15
|
+
}
|
16
|
+
assert do
|
17
|
+
connect(ActiveLdap::Base)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_configuration_with_special_key
|
22
|
+
ActiveLdap::Base.configurations[LDAP_ENV] = {
|
23
|
+
"special" => current_configuration
|
24
|
+
}
|
25
|
+
assert do
|
26
|
+
connect(ActiveLdap::Base, {name: :special})
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_configuration_with_special_key_as_string
|
31
|
+
ActiveLdap::Base.configurations[LDAP_ENV] = {
|
32
|
+
"special" => current_configuration
|
33
|
+
}
|
34
|
+
assert do
|
35
|
+
connect(ActiveLdap::Base, {name: "special"})
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def test_configuration_with_special_key_without_ldap_env
|
40
|
+
begin
|
41
|
+
ActiveLdap::Base.configurations = {
|
42
|
+
"special" => ActiveLdap::Base.configurations[LDAP_ENV]
|
43
|
+
}
|
44
|
+
|
45
|
+
# temporarily undefine LDAP_ENV
|
46
|
+
ldap_env = LDAP_ENV
|
47
|
+
Object.__send__(:remove_const, :LDAP_ENV)
|
48
|
+
|
49
|
+
assert do
|
50
|
+
connect(ActiveLdap::Base, {name: :special})
|
51
|
+
end
|
52
|
+
ensure
|
53
|
+
Object.const_set(:LDAP_ENV, ldap_env)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def test_configuration_with_special_key_and_missing_config
|
58
|
+
message = "special connection is not configured"
|
59
|
+
assert_raise(ActiveLdap::ConnectionError.new(message)) do
|
60
|
+
connect(ActiveLdap::Base, {name: :special})
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_configuration_per_class
|
65
|
+
make_ou("Primary")
|
66
|
+
make_ou("Sub")
|
67
|
+
primary_class = ou_class("ou=Primary")
|
68
|
+
sub_class = ou_class("ou=Sub")
|
69
|
+
|
70
|
+
configuration = current_configuration.symbolize_keys
|
71
|
+
configuration[:scope] = :base
|
72
|
+
current_base = configuration[:base]
|
73
|
+
|
74
|
+
primary_configuration = configuration.dup
|
75
|
+
primary_configuration[:base] = "ou=Primary,#{current_base}"
|
76
|
+
|
77
|
+
sub_configuration = configuration.dup
|
78
|
+
sub_configuration[:base] = "ou=Sub,#{current_base}"
|
79
|
+
|
80
|
+
ActiveLdap::Base.configurations[LDAP_ENV] = {
|
81
|
+
"primary" => primary_configuration,
|
82
|
+
"sub" => sub_configuration
|
83
|
+
}
|
84
|
+
assert do
|
85
|
+
connect(primary_class) and connect(sub_class, {name: :sub})
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
private
|
90
|
+
def connect(klass, config = nil)
|
91
|
+
klass.setup_connection(config)
|
92
|
+
klass.connection.connect
|
93
|
+
end
|
94
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activeldap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.2.
|
4
|
+
version: 7.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Will Drewry
|
8
8
|
- Kouhei Sutou
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -307,6 +307,7 @@ files:
|
|
307
307
|
- test/test_ldif.rb
|
308
308
|
- test/test_load.rb
|
309
309
|
- test/test_lpasswd.rb
|
310
|
+
- test/test_multi_configuration.rb
|
310
311
|
- test/test_object_class.rb
|
311
312
|
- test/test_persistence.rb
|
312
313
|
- test/test_reflection.rb
|
@@ -327,9 +328,13 @@ files:
|
|
327
328
|
- test/test_validation.rb
|
328
329
|
homepage: http://activeldap.github.io/
|
329
330
|
licenses:
|
330
|
-
- Ruby
|
331
|
-
-
|
332
|
-
metadata:
|
331
|
+
- Ruby
|
332
|
+
- GPL-2.0-or-later
|
333
|
+
metadata:
|
334
|
+
bug_tracker_uri: https://github.com/activeldap/activeldap/issues
|
335
|
+
changelog_uri: https://github.com/activeldap/activeldap/blob/7.2.2/doc/text/news.md
|
336
|
+
homepage_uri: https://activeldap.github.io/
|
337
|
+
source_code_uri: https://github.com/activeldap/activeldap
|
333
338
|
rdoc_options: []
|
334
339
|
require_paths:
|
335
340
|
- lib
|
@@ -344,7 +349,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
344
349
|
- !ruby/object:Gem::Version
|
345
350
|
version: '0'
|
346
351
|
requirements: []
|
347
|
-
rubygems_version: 3.6.
|
352
|
+
rubygems_version: 3.6.7
|
348
353
|
specification_version: 4
|
349
354
|
summary: ActiveLdap is a object-oriented API to LDAP
|
350
355
|
test_files:
|
@@ -380,6 +385,7 @@ test_files:
|
|
380
385
|
- test/test_ldif.rb
|
381
386
|
- test/test_load.rb
|
382
387
|
- test/test_lpasswd.rb
|
388
|
+
- test/test_multi_configuration.rb
|
383
389
|
- test/test_object_class.rb
|
384
390
|
- test/test_persistence.rb
|
385
391
|
- test/test_reflection.rb
|