Module: ADMapper::Group::InstanceMethods

Defined in:
lib/admapper/group.rb

Instance Method Summary collapse

Instance Method Details

#ad_mapObject

Default mapping of user object to active directory. You will most likely want to implement this in your own class instead of using this very basic default. Simply map your model (keys of the hash) to ActiveDirectory (values of the hash)

def ad_map
  {
    :username => :samaccountname,
    :full_name => :displayname
  }
end


36
37
38
# File 'lib/admapper/group.rb', line 36

def ad_map
  {:name => :cn}
end

#map_group_from_ad(ad_group) ⇒ Object

maps the ad_user’s attributes to your class’ attributes . Implement the ad_map method in your own class to control how fields map.



18
19
20
21
22
23
# File 'lib/admapper/group.rb', line 18

def map_group_from_ad(ad_group)
   self.ad_map.each do |group_object_field, ad_object_field|           
     self.send("#{group_object_field}=", ad_group.send(ad_object_field).to_s)
  end
  self.ad_group = ad_group
end