Class: ActiveDirectory::FieldType::MemberDnArray
- Inherits:
-
Object
- Object
- ActiveDirectory::FieldType::MemberDnArray
- Defined in:
- lib/active_directory/field_type/member_dn_array.rb
Class Method Summary collapse
-
.decode(dn_array) ⇒ Object
Decodes a list of DNs into the objects that they are.
-
.encode(obj_array) ⇒ Object
Encodes an array of objects into a list of dns.
Class Method Details
.decode(dn_array) ⇒ Object
Decodes a list of DNs into the objects that they are
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/active_directory/field_type/member_dn_array.rb', line 34 def self.decode(dn_array) # Ensures that the objects are cast correctly users = User.find(:all, :distinguishedname => dn_array) groups = Group.find(:all, :distinguishedname => dn_array) arr = Array.new arr << users unless users.nil? arr << groups unless groups.nil? return arr.flatten end |
.encode(obj_array) ⇒ Object
Encodes an array of objects into a list of dns
27 28 29 |
# File 'lib/active_directory/field_type/member_dn_array.rb', line 27 def self.encode(obj_array) obj_array.collect { |obj| obj.dn } end |