Module: Ldapter
- Defined in:
- lib/ldapter.rb,
lib/ldapter/entry.rb,
lib/ldapter/errors.rb,
lib/ldapter/schema.rb,
lib/ldapter/methods.rb,
lib/ldapter/adapters.rb,
lib/ldapter/syntaxes.rb,
lib/ldapter/attribute_set.rb,
lib/ldapter/before_type_cast.rb,
lib/ldapter/adapters/abstract_adapter.rb,
lib/ldapter/adapters/net_ldap_adapter.rb,
lib/ldapter/adapters/ldap_conn_adapter.rb,
lib/ldapter/adapters/active_directory_adapter.rb
Overview
Getting started
See the methods of the Ldapter module (below) for information on connecting.
See the Ldapter::Methods module for information on searching with your connection object.
Search results are Ldapter::Entry objects. See the documentation for this class for information on manipulating and updating them, as well as creating new entries.
Defined Under Namespace
Modules: Adapters, BeforeTypeCast, Errors, Methods, Schema, Syntaxes Classes: AttributeSet, Class, Entry, Error, Module, ServerError
Constant Summary
- SCOPES =
{ :base => 0, # ::LDAP::LDAP_SCOPE_BASE, :onelevel => 1, # ::LDAP::LDAP_SCOPE_ONELEVEL, :subtree => 2 # ::LDAP::LDAP_SCOPE_SUBTREE }
- SYNTAXES =
{}
Class Method Summary (collapse)
-
+ (Object) Class(options)
(also: Namespace)
The core constructor of Ldapter.
-
+ (Object) Module(options)
Similar to Ldapter::Class, accepting the same options.
-
+ (Object) Object(options, &block)
Returns an object that can be assigned directly to a variable.
Class Method Details
+ (Object) Class(options) Also known as: Namespace
The core constructor of Ldapter. This method returns an anonymous class which can then be inherited from.
The new class is not intended to be instantiated, instead serving as a namespace. Included in this namespace is a set of class methods, as found in Ldapter::Methods, and a class hierarchy mirroring the object classes found on the server.
= {
:adapter => :active_directory,
:host => "pdc.mycompany.com",
:username => "mylogin@mycompany.com",
:password => "mypassword"
}
class MyCompany < Ldapter::Class()
# This class and many others are created automatically based on
# information from the server.
class User
alias login sAMAccountName
end
end
me = MyCompany.search(:filter => {:cn => "Name, My"}).first
puts me.login
Options given to this method are relayed to Ldapter::Adapters.for. The documentation for this method should be consulted for further information.
92 93 94 95 96 |
# File 'lib/ldapter.rb', line 92 def self.Class() klass = ::Class.new(Class) klass.instance_variable_set(:@options, Ldapter::Adapters.for()) klass end |
+ (Object) Module(options)
Similar to Ldapter::Class, accepting the same options. Instead of returning an anonymous class that activates upon inheritance, it returns an anonymous module that activates upon inclusion.
module MyCompany
include Ldapter::Module()
# This class and many others are created automatically based on
# information from the server.
class User
alias login sAMAccountName
end
end
me = MyCompany.search(:filter => {:cn => "Name, My"}).first
puts me.login
60 61 62 |
# File 'lib/ldapter.rb', line 60 def self.Module() Ldapter::Module.new() end |
+ (Object) Object(options, &block)
Returns an object that can be assigned directly to a variable. This allows for an "anonymous" Ldapter object.
@my_company = Ldapter::Object()
@my_company::User.class_eval do
alias login sAMAccountName
end
36 37 38 39 40 41 42 43 44 |
# File 'lib/ldapter.rb', line 36 def self.Object(,&block) base = ::Module.new do include Ldapter::Module() end if block_given? base.class_eval(&block) end base end |