Class: Adauth::AdObjects::Group

Inherits:
Adauth::AdObject show all
Defined in:
lib/adauth/ad_objects/group.rb

Overview

Active Directory Group Object

Inherits from Adauth::AdObject

Constant Summary collapse

Fields =

Field mapping

Maps methods to LDAP fields e.g.

:foo => :bar

Becomes

Computer.name

Which calls .name on the LDAP object

{
    :name => :samaccountname,
    :cn_members => [ :member,
        Proc.new {|g| g.sub(/.*?CN=(.*?),.*/, '\1')} ],
    :memberof => :member
    #:cn_groups => [ :memberof,
    #    Proc.new {|g| g.sub(/.*?CN=(.*?),.*/, '\1')} ]
}
ObjectFilter =

Object Net::LDAP filter

Used to restrict searches’ to just this object

Net::LDAP::Filter.eq("objectClass", "group")

Instance Method Summary collapse

Methods inherited from Adauth::AdObject

add_object_filter, all, #cn_groups_nested, #dn_ous, filter, #groups, #handle_field, #initialize, #is_a_member?, #ldap_object, #method_missing, #modify, #ous, where

Constructor Details

This class inherits a constructor from Adauth::AdObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Adauth::AdObject

Instance Method Details

#cn_groupsObject



41
42
43
# File 'lib/adauth/ad_objects/group.rb', line 41

def cn_groups
  memberof.split(/.*?CN=(.*?),.*/)
end

#membersObject

Returns all the objects which are members of this group



33
34
35
36
37
38
39
# File 'lib/adauth/ad_objects/group.rb', line 33

def members
    Adauth.logger.info(self.class.inspect) { "Getting group members for #{self.name}" }
    unless @members
        @members = convert_to_objects(cn_members)
    end
    @members
end