In: |
lib/activeldap/base.rb
|
Parent: | Object |
Base is the primary class which contains all of the core ActiveLDAP functionality. It is meant to only ever be subclassed by extension classes.
methods | -> | __methods |
Add available attributes to the methods |
logger | [RW] | |
may | [R] | Parsed schema structures |
must | [R] | Parsed schema structures |
This method when included into Base provides an inheritable, overwritable configuration setting
This should be a string with the base of the ldap server such as ‘dc=example,dc=com’, and it should be overwritten by including configuration.rb into this class. When subclassing, the specified prefix will be concatenated.
Base.close This method deletes the LDAP connection object. This does NOT reset any overridden values from a Base.connect call.
Connect and bind to LDAP creating a class variable for use by all ActiveLDAP objects.
config must be a hash that may contain any of the following fields: :user, :password_block, :logger, :host, :port, :base, :bind_format, :try_sasl, :allow_anonymous :user specifies the username to bind with. :bind_format specifies the string to substitute the username into on bind. e.g. uid=%s,ou=People,dc=example,dc=com. Overrides @@bind_format. :password_block specifies a Proc object that will yield a String to be used as the password when called. :logger specifies a preconfigured Log4r::Logger to be used for all logging :host overrides the configuration.rb @@host setting with the LDAP server hostname :port overrides the configuration.rb @@port setting for the LDAP server port :base overwrites Base.base - this affects EVERYTHING :try_sasl indicates that a SASL bind should be attempted when binding to the server (default: false) :allow_anonymous indicates that a true anonymous bind is allowed when trying to bind to the server (default: true)
Driver generator
TODO add type checking This let’s you call this method to create top-level extension object. This is really just a proof of concept and has not truly useful purpose. example: Base.create_object(:class => "user", :dnattr => "uid", :classes => [‘top’])
This is a placeholder for the class method that will be overridden on calling ldap_mapping in a subclass. Using a class method allows for clean inheritance from classes that already have a ldap_mapping.
This method when included into Base provides an inheritable, overwritable configuration setting
The value should be the minimum required objectClasses to make an object in the LDAP server, or an empty array []. This should be overwritten by configuration.rb. Note that subclassing does not cause concatenation of arrays to occurs.
search
Wraps Ruby/LDAP connection.search to make it easier to search for specific data without cracking open Base.connection
attributes
Return attribute methods so that a program can determine available attributes dynamically without schema awareness
If a given method matches an attribute or an attribute alias then call the appropriate method. TODO: Determine if it would be better to define each allowed method
using class_eval instead of using method_missing. This would give tab completion in irb.
validate
Basic validation:
Must call enforce_types() first before enforcement can be guaranteed