lib/activeldap.rb in ruby-activeldap-0.7.1 vs lib/activeldap.rb in ruby-activeldap-0.7.2
- old
+ new
@@ -175,11 +175,12 @@
# with Ruby/ActiveLDAP. It must be called inside of a subclass as shown above.
#
# Below is a much more realistic Group class:
#
# class Group < ActiveLDAP::Base
-# ldap_mapping :dnattr => 'cn', :prefix => 'ou=Groups', :classes => ['top', 'posixGroup']
+# ldap_mapping :dnattr => 'cn', :prefix => 'ou=Groups', :classes => ['top', 'posixGroup']<
+# :scope => LDAP::LDAP_SCOPE_ONELEVEL
# end
#
# As you can see, this method is used for defining how this class maps in to LDAP. Let's say that
# my LDAP tree looks something like this:
#
@@ -203,10 +204,12 @@
# ^^ ^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^
# :dnattr | |
# :prefix |
# :base from configuration.rb
#
+# :scope tells ActiveLDAP to only search under ou=Groups, and not to look deeper
+# for dnattr matches. (e.g. cn=develop,ou=DevGroups,ou=Groups,dc=dataspill,dc=org)
#
# Something's missing: :classes. :classes is used to tell Ruby/ActiveLDAP what
# the minimum requirement is when creating a new object. LDAP uses objectClasses
# to define what attributes a LDAP object may have. Ruby/ActiveLDAP needs to know
# what classes are required when creating a new object. Of course, you can leave
@@ -220,11 +223,14 @@
# structural objectclasses may not be removed (or replaced). Setting a sane default
# may help avoid programmer error later.
#
# :classes isn't the only optional argument. If :dnattr is left off, it defaults
# to 'cn'. If :prefix is left off, it will default to 'ou=CLASSNAME'. In this
-# case, it would be 'ou=Group'.
+# case, it would be 'ou=Group'. There is also a :parent_class option which, when
+# specified, adds a method call parent() which will return the
+# parent_class.new(parent_dn). The parent_dn is the objects dn without the dnattr
+# pair.
#
# :classes should be an Array. :dnattr should be a String and so should :prefix.
#
#
# ===== belongs_to
@@ -484,16 +490,24 @@
# whether the :password_block should be called on each reconnect.
# * :allow_anonymous determines whether anonymous binding is allowed if other
# bind methods fail
# * :try_sasl, when true, tells ActiveLDAP to attempt a SASL-GSSAPI bind
# * :sasl_quiet, when true, tells the SASL libraries to not spew messages to STDOUT
+# * :method indicates whether to use :ssl, :tls, or :plain
+# * :retries - indicates the number of attempts to reconnect that will be undertaken when a stale connection occurs. -1 means infinite.
+# * :retry_wait - seconds to wait before retrying a connection
+# * :ldap_scope - dictates how to find objects. (Default: ONELEVEL)
+# * :return_objects - indicates whether find/find_all will return objects or just the distinguished name attribute value of the matches. Rails users will find this useful.
+# * :timeout - time in seconds - defaults to disabled. This CAN interrupt search() requests. Be warned.
+# * :retry_on_timeout - whether to reconnect when timeouts occur. Defaults to true
+# See lib/configuration.rb for defaults for each option
#
# Base.connect both connects and binds in one step. It follows roughly the following approach:
#
# * Connect to host:port using :method
#
-# * If user and password_block, attempt to bind with credentials.
+# * If user and password_block/password, attempt to bind with credentials.
# * If that fails or no password_block and anonymous allowed, attempt to bind
# anonymously.
# * If that fails, error out.
#
# On connect, the configuration options passed in are stored in an internal class variable
@@ -905,16 +919,21 @@
# Blanket warning hiding. Remove for debugging
$VERBOSE, verbose = false, $VERBOSE
require 'activeldap/ldap'
require 'activeldap/schema2'
+if RUBY_PLATFORM.match('linux')
+ require 'activeldap/timeout'
+else
+ require 'activeldap/timeout_stub'
+end
require 'activeldap/base'
require 'activeldap/associations'
require 'activeldap/configuration'
module ActiveLDAP
- VERSION = "0.7.1"
+ VERSION = "0.7.2"
end
ActiveLDAP::Base.class_eval do
include ActiveLDAP::Configuration
include ActiveLDAP::Associations