ruby-activeldap 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/activeldap/base.rb +9 -7
- data/lib/activeldap/schema2.rb +10 -4
- data/lib/activeldap.rb +1 -1
- metadata +2 -2
data/lib/activeldap/base.rb
CHANGED
@@ -612,9 +612,7 @@ module ActiveLDAP
|
|
612
612
|
|
613
613
|
# Make sure all MUST attributes have a value
|
614
614
|
@data['objectClass'].each do |objc|
|
615
|
-
must
|
616
|
-
may = Base.schema.attr('objectClasses', objc, 'MAY')
|
617
|
-
must.each do |req_attr|
|
615
|
+
@must.each do |req_attr|
|
618
616
|
deref = @attr_methods[req_attr]
|
619
617
|
if @data[deref] == []
|
620
618
|
raise AttributeEmpty,
|
@@ -887,13 +885,17 @@ module ActiveLDAP
|
|
887
885
|
# Build |data| from schema
|
888
886
|
# clear attr_method mapping first
|
889
887
|
@attr_methods = {}
|
890
|
-
|
888
|
+
@must = []
|
889
|
+
@may = []
|
891
890
|
new_oc.each do |objc|
|
892
891
|
# get all attributes for the class
|
893
|
-
attributes
|
892
|
+
attributes = Base.schema.class_attributes(objc.to_s)
|
893
|
+
@must += attributes[:must]
|
894
|
+
@may += attributes[:may]
|
894
895
|
end
|
895
|
-
|
896
|
-
|
896
|
+
@must.uniq!
|
897
|
+
@may.uniq!
|
898
|
+
(@must+@may).each do |attr|
|
897
899
|
# Update attr_method with appropriate
|
898
900
|
define_attribute_methods(attr)
|
899
901
|
end
|
data/lib/activeldap/schema2.rb
CHANGED
@@ -151,8 +151,12 @@ module LDAP
|
|
151
151
|
return @@class_cache[objc]
|
152
152
|
end
|
153
153
|
|
154
|
+
# Setup the cache
|
155
|
+
@@class_cache[objc] = {}
|
156
|
+
|
154
157
|
# First get all the current level attributes
|
155
|
-
@@class_cache[objc] = attr('objectClasses', objc, 'MUST')
|
158
|
+
@@class_cache[objc] = {:must => attr('objectClasses', objc, 'MUST'),
|
159
|
+
:may => attr('objectClasses', objc, 'MAY')}
|
156
160
|
|
157
161
|
# Now add all attributes from the parent object (SUPerclasses)
|
158
162
|
# Hopefully an iterative approach will be pretty speedy
|
@@ -166,15 +170,17 @@ module LDAP
|
|
166
170
|
new_sups += attr('objectClasses', sup, 'SUP')
|
167
171
|
end
|
168
172
|
sups += new_sups
|
169
|
-
sups
|
173
|
+
sups.uniq!
|
170
174
|
break if sups.size == start_size
|
171
175
|
end
|
172
176
|
sups.each do |sup|
|
173
|
-
@@class_cache[objc] += attr('objectClasses', sup, 'MUST')
|
177
|
+
@@class_cache[objc][:must] += attr('objectClasses', sup, 'MUST')
|
178
|
+
@@class_cache[objc][:may] += attr('objectClasses', sup, 'MAY')
|
174
179
|
end
|
175
180
|
|
176
181
|
# Clean out the dupes.
|
177
|
-
@@class_cache[objc]
|
182
|
+
@@class_cache[objc][:must].uniq!
|
183
|
+
@@class_cache[objc][:may].uniq!
|
178
184
|
|
179
185
|
# Return the cached value
|
180
186
|
return @@class_cache[objc].dup
|
data/lib/activeldap.rb
CHANGED
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.1
|
|
3
3
|
specification_version: 1
|
4
4
|
name: ruby-activeldap
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.5.
|
7
|
-
date: 2004-10-
|
6
|
+
version: 0.5.1
|
7
|
+
date: 2004-10-22
|
8
8
|
summary: Ruby/ActiveLDAP is a object-oriented API to LDAP
|
9
9
|
require_paths:
|
10
10
|
- lib
|