Sha256: 5a149d0f9a2e6408925f26869d5c5405ccf0b0bb5e91c69fe36f7bb4b21ab97c

Contents?: true

Size: 1.26 KB

Versions: 3

Compression:

Stored size: 1.26 KB

Contents

module Adauth
    module AdObjects
        # Active Directory OU Object
        #
        # Inherits from Adauth::AdObject
        class OU < Adauth::AdObject
            # Field mapping
            #
            # Maps methods to LDAP fields e.g.
            #
            # :foo => :bar
            #
            # Becomes
            # 
            # Computer.name
            #
            # Which calls .name on the LDAP object
            Fields = {
                    :name => :name
                }
            
            # Object Net::LDAP filter
            #
            # Used to restrict searches to just this object
            ObjectFilter = Net::LDAP::Filter.eq("objectClass", "organizationalUnit")
            
            # Returns all objects contained with in this OU
            def members
                unless @members
                    @members = []
                    [Adauth::AdObjects::Computer, Adauth::AdObjects::Group, Adauth::AdObjects::User].each do |object|
                        object.all.each do |entity|
                            @members.push entity if entity.ldap_object.dn =~ /#{@ldap_object.dn}/
                        end
                    end
                end
                @members
            end
        end
    end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
adauth-2.0.0pre2 lib/adauth/ad_objects/ou.rb
adauth-2.0.0pre1 lib/adauth/ad_objects/ou.rb
adauth-2.0.0pre lib/adauth/ad_objects/ou.rb