Class Zend_Ldap

Description
  • copyright: Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
  • license: New BSD License

Located in /Ldap.php (line 29)


	
			
Class Constant Summary
Variable Summary
Method Summary
 static boolean explodeDn (string $dn, [ &$keys = null], [ &$vals = null], array $keys, array $vals)
 static string filterEscape (string $str)
 static void prepareLdapEntryArray ( &$entry, array $entry)
 Zend_Ldap add (string|Zend_Ldap_Dn $dn,  $entry)
 Zend_Ldap bind ([string $username = null], [string $password = null])
 Zend_Ldap connect ([string $host = null], [int $port = null], [boolean $useSsl = null], [boolean $useStartTls = null])
 Zend_Ldap copy (string|Zend_Ldap_Dn $from, string|Zend_Ldap_Dn $to, [boolean $recursively = false])
 Zend_Ldap copyToSubtree (string|Zend_Ldap_Dn $from, string|Zend_Ldap_Dn $to, [boolean $recursively = false])
 integer count (string|Zend_Ldap_Filter_Abstract $filter, [string|Zend_Ldap_Dn|null $basedn = null], [integer $scope = self::SEARCH_SCOPE_SUB])
 integer countChildren (string|Zend_Ldap_Dn $dn)
 Zend_Ldap delete (string|Zend_Ldap_Dn $dn, [boolean $recursively = false])
 boolean exists (string|Zend_Ldap_Dn $dn)
 string getBaseDn ()
 false|null|string getBoundUser ()
 string getCanonicalAccountName (string $acctname, [ $form = 0], int $type)
 array getEntry (string|Zend_Ldap_Dn $dn, [ $attributes = array()], [boolean $throwOnNotFound = false])
 string getLastError ([ &$errorCode = null], [ &$errorMessages = null], int $errorCode, array $errorMessages)
 Zend_Ldap_Node|null getNode (string|Zend_Ldap_Dn $dn)
 array getOptions ()
 resource getResource ()
 Zend_Ldap move (string|Zend_Ldap_Dn $from, string|Zend_Ldap_Dn $to, [boolean $recursively = false], [boolean $alwaysEmulate = false])
 Zend_Ldap moveToSubtree (string|Zend_Ldap_Dn $from, string|Zend_Ldap_Dn $to, [boolean $recursively = false], [boolean $alwaysEmulate = false])
 Zend_Ldap rename (string|Zend_Ldap_Dn $from, string|Zend_Ldap_Dn $to, [boolean $recursively = false], [boolean $alwaysEmulate = false])
 Zend_Ldap save (string|Zend_Ldap_Dn $dn,  $entry)
 Zend_Ldap_Collection search (string|Zend_Ldap_Filter_Abstract|array $filter, [string|Zend_Ldap_Dn|null $basedn = null], [integer $scope = self::SEARCH_SCOPE_SUB], [ $attributes = array()], [string|null $sort = null], [string|null $collectionClass = null])
 array searchEntries (string|Zend_Ldap_Filter_Abstract|array $filter, [string|Zend_Ldap_Dn|null $basedn = null], [integer $scope = self::SEARCH_SCOPE_SUB], [ $attributes = array()], [string|null $sort = null], [boolean $reverseSort = false])
 void __construct ([array|Zend_Config $options = array()])
 void __destruct ()
 Zend_Ldap setOptions (array|Zend_Config $options)
 Zend_Ldap update (string|Zend_Ldap_Dn $dn,  $entry)
 array _getAccount ( $acctname, [ $attrs = null])
 string _getAccountDn (string $acctname)
 string _getAccountFilter ( $acctname)
 boolean _getBindRequiresDn ()
 array _getChildrenDns (string|Zend_Ldap_Dn $parentDn)
 string _getHost ()
 boolean _getOptReferrals ()
 string _getPassword ()
 int _getPort ()
 string _getUsername ()
 boolean _getUseSsl ()
 boolean _getUseStartTls ()
 boolean _isPossibleAuthority (string $dname)
 void _splitName (string $name,  &$dname,  &$aname, string $dname, string $aname)
Variables
boolean|null|string $_boundUser = false (line 68)

FALSE if no user is bound to the LDAP resource NULL if there has been an anonymous bind username of the currently bound user

  • access: protected
array $_options = null (line 52)

The options used in connecting, binding, etc.

  • access: protected
resource $_resource = null (line 59)

The raw LDAP extension resource.

  • access: protected
Zend_Ldap_Node $_rootDse = null (line 75)

Caches the RootDSE

  • access: protected
Zend_Ldap_Node $_schema = null (line 82)

Caches the schema

  • access: protected
Methods
static explodeDn (line 106)
  • return: True if the DN was successfully parsed or false if the string is not a valid DN.
  • deprecated: will be removed, use {@see Zend_Ldap_Dn::checkDn()}
  • access: public
static boolean explodeDn (string $dn, [ &$keys = null], [ &$vals = null], array $keys, array $vals)
  • string $dn: The DN to parse
  • array $keys: An optional array to receive DN keys (e.g. CN, OU, DC, ...)
  • array $vals: An optional array to receive DN values
  • array &$keys
  • array &$vals
static filterEscape (line 89)
  • return: The escaped string
  • deprecated: will be removed, use {@see Zend_Ldap_Filter_Abstract::escapeValue()}
  • access: public
static string filterEscape (string $str)
  • string $str: The string to escape.
static prepareLdapEntryArray (line 1140)

Prepares an ldap data entry array for insert/update operation

  • throws: InvalidArgumentException
  • access: public
static void prepareLdapEntryArray ( &$entry, array $entry)
  • array $entry
  • array &$entry
add (line 1184)

Add new information to the LDAP repository

  • return: Provides a fluid interface
  • throws: Zend_Ldap_Exception
  • access: public
Zend_Ldap add (string|Zend_Ldap_Dn $dn,  $entry)
bind (line 813)
  • return: Provides a fluent interface
  • throws: Zend_Ldap_Exception
  • access: public
Zend_Ldap bind ([string $username = null], [string $password = null])
  • string $username: The username for authenticating the bind
  • string $password: The password for authenticating the bind
connect (line 722)

To connect using SSL it seems the client tries to verify the server

certificate by default. One way to disable this behavior is to set 'TLS_REQCERT never' in OpenLDAP's ldap.conf and restarting Apache. Or, if you really care about the server's cert you can put a cert on the web server.

  • return: Provides a fluent interface
  • throws: Zend_Ldap_Exception
  • access: public
Zend_Ldap connect ([string $host = null], [int $port = null], [boolean $useSsl = null], [boolean $useStartTls = null])
  • string $host: The hostname of the LDAP server to connect to
  • int $port: The port number of the LDAP server to connect to
  • boolean $useSsl: Use SSL
  • boolean $useStartTls: Use STARTTLS
copy (line 1485)

Copies a LDAP entry from one DN to another DN.

  • return: Provides a fluid interface
  • throws: Zend_Ldap_Exception
  • access: public
Zend_Ldap copy (string|Zend_Ldap_Dn $from, string|Zend_Ldap_Dn $to, [boolean $recursively = false])
copyToSubtree (line 1457)

Copies a LDAP entry from one DN to another subtree.

  • return: Provides a fluid interface
  • throws: Zend_Ldap_Exception
  • access: public
Zend_Ldap copyToSubtree (string|Zend_Ldap_Dn $from, string|Zend_Ldap_Dn $to, [boolean $recursively = false])
count (line 1035)

Count items found by given filter.

  • throws: Zend_Ldap_Exception
  • access: public
integer count (string|Zend_Ldap_Filter_Abstract $filter, [string|Zend_Ldap_Dn|null $basedn = null], [integer $scope = self::SEARCH_SCOPE_SUB])
countChildren (line 1053)

Count children for a given DN.

  • throws: Zend_Ldap_Exception
  • access: public
integer countChildren (string|Zend_Ldap_Dn $dn)
delete (line 1297)

Delete an LDAP entry

  • return: Provides a fluid interface
  • throws: Zend_Ldap_Exception
  • access: public
Zend_Ldap delete (string|Zend_Ldap_Dn $dn, [boolean $recursively = false])
disconnect (line 698)
  • return: Provides a fluent interface
  • access: public
Zend_Ldap disconnect ()
exists (line 1065)

Check if a given DN exists.

  • throws: Zend_Ldap_Exception
  • access: public
boolean exists (string|Zend_Ldap_Dn $dn)
getBaseDn (line 385)

Gets the base DN under which objects of interest are located

  • access: public
string getBaseDn ()
getBaseNode (line 1530)

Returns the base node as a Zend_Ldap_Node

  • throws: Zend_Ldap_Exception
  • access: public
Zend_Ldap_Node getBaseNode ()
getBoundUser (line 232)

Get the currently bound user

FALSE if no user is bound to the LDAP resource NULL if there has been an anonymous bind username of the currently bound user

  • access: public
false|null|string getBoundUser ()
getCanonicalAccountName (line 571)
  • return: The canonicalized name in the desired form
  • throws: Zend_Ldap_Exception
  • access: public
string getCanonicalAccountName (string $acctname, [ $form = 0], int $type)
  • string $acctname: The name to canonicalize
  • int $type: The desired form of canonicalization
  • $form
getEntry (line 1121)

Get LDAP entry by DN

  • throws: Zend_Ldap_Exception
  • access: public
array getEntry (string|Zend_Ldap_Dn $dn, [ $attributes = array()], [boolean $throwOnNotFound = false])
  • string|Zend_Ldap_Dn $dn
  • array $attributes
  • boolean $throwOnNotFound
getLastError (line 187)

Return the LDAP error message of the last LDAP command

  • access: public
string getLastError ([ &$errorCode = null], [ &$errorMessages = null], int $errorCode, array $errorMessages)
  • int $errorCode
  • array $errorMessages
  • &$errorCode
  • array &$errorMessages
getLastErrorCode (line 161)

Return the LDAP error number of the last LDAP command

  • access: public
int getLastErrorCode ()
getNode (line 1515)

Returns the specified DN as a Zend_Ldap_Node

  • throws: Zend_Ldap_Exception
  • access: public
Zend_Ldap_Node|null getNode (string|Zend_Ldap_Dn $dn)
getOptions (line 327)
  • return: The current options.
  • access: public
array getOptions ()
getResource (line 148)
  • return: The raw LDAP extension resource.
  • access: public
resource getResource ()
getRootDse (line 1541)

Returns the RootDSE

  • throws: Zend_Ldap_Exception
  • access: public
Zend_Ldap_Node_RootDse getRootDse ()
getSchema (line 1559)

Returns the schema

  • throws: Zend_Ldap_Exception
  • access: public
Zend_Ldap_Node_Schema getSchema ()
move (line 1395)

Moves a LDAP entry from one DN to another DN.

This is an alias for rename()

  • return: Provides a fluid interface
  • throws: Zend_Ldap_Exception
  • access: public
Zend_Ldap move (string|Zend_Ldap_Dn $from, string|Zend_Ldap_Dn $to, [boolean $recursively = false], [boolean $alwaysEmulate = false])
moveToSubtree (line 1364)

Moves a LDAP entry from one DN to another subtree.

  • return: Provides a fluid interface
  • throws: Zend_Ldap_Exception
  • access: public
Zend_Ldap moveToSubtree (string|Zend_Ldap_Dn $from, string|Zend_Ldap_Dn $to, [boolean $recursively = false], [boolean $alwaysEmulate = false])
rename (line 1412)

Renames a LDAP entry from one DN to another DN.

This method implicitely moves the entry to another location within the tree.

  • return: Provides a fluid interface
  • throws: Zend_Ldap_Exception
  • access: public
Zend_Ldap rename (string|Zend_Ldap_Dn $from, string|Zend_Ldap_Dn $to, [boolean $recursively = false], [boolean $alwaysEmulate = false])
save (line 1279)

Save entry to LDAP registry.

Internally decides if entry will be updated to added by calling exists().

  • return: Provides a fluid interface
  • throws: Zend_Ldap_Exception
  • access: public
Zend_Ldap save (string|Zend_Ldap_Dn $dn,  $entry)
search (line 926)

A global LDAP search routine for finding information.

Options can be either passed as single parameters according to the method signature or as an array with one or more of the following keys

  • filter
  • baseDn
  • scope
  • attributes
  • sort
  • collectionClass

  • throws: Zend_Ldap_Exception
  • access: public
Zend_Ldap_Collection search (string|Zend_Ldap_Filter_Abstract|array $filter, [string|Zend_Ldap_Dn|null $basedn = null], [integer $scope = self::SEARCH_SCOPE_SUB], [ $attributes = array()], [string|null $sort = null], [string|null $collectionClass = null])
searchEntries (line 1091)

Search LDAP registry for entries matching filter and optional attributes

Options can be either passed as single parameters according to the method signature or as an array with one or more of the following keys

  • filter
  • baseDn
  • scope
  • attributes
  • sort
  • reverseSort

  • throws: Zend_Ldap_Exception
  • access: public
array searchEntries (string|Zend_Ldap_Filter_Abstract|array $filter, [string|Zend_Ldap_Dn|null $basedn = null], [integer $scope = self::SEARCH_SCOPE_SUB], [ $attributes = array()], [string|null $sort = null], [boolean $reverseSort = false])
Constructor __construct (line 122)

Constructor.

  • throws: Zend_Ldap_Exception if ext/ldap is not installed
  • access: public
void __construct ([array|Zend_Config $options = array()])
  • array|Zend_Config $options: Options used in connecting, binding, etc.
Destructor __destruct (line 140)

Destructor.

  • access: public
void __destruct ()
setOptions (line 261)

Sets the options used in connecting, binding, etc.

Valid option keys: host port useSsl username password bindRequiresDn baseDn accountCanonicalForm accountDomainName accountDomainNameShort accountFilterFormat allowEmptyPassword useStartTls optRefferals tryUsernameSplit

  • return: Provides a fluent interface
  • throws: Zend_Ldap_Exception
  • access: public
Zend_Ldap setOptions (array|Zend_Config $options)
  • array|Zend_Config $options: Options used in connecting, binding, etc.
update (line 1232)

Update LDAP registry

  • return: Provides a fluid interface
  • throws: Zend_Ldap_Exception
  • access: public
Zend_Ldap update (string|Zend_Ldap_Dn $dn,  $entry)
_getAccount (line 642)
  • return: An array of the attributes representing the account
  • throws: Zend_Ldap_Exception
  • access: protected
array _getAccount ( $acctname, [ $attrs = null])
  • array $attrs: An array of names of desired attributes
  • $acctname
_getAccountCanonicalForm (line 394)
  • return: Either ACCTNAME_FORM_BACKSLASH, ACCTNAME_FORM_PRINCIPAL or ACCTNAME_FORM_USERNAME indicating the form usernames should be canonicalized to.
  • access: protected
integer _getAccountCanonicalForm ()
_getAccountDn (line 530)
  • return: The DN of the specified account
  • throws: Zend_Ldap_Exception
  • access: protected
string _getAccountDn (string $acctname)
  • string $acctname: The name of the account
_getAccountDomainName (line 421)
  • return: The account domain name
  • access: protected
string _getAccountDomainName ()
_getAccountDomainNameShort (line 429)
  • return: The short account domain name
  • access: protected
string _getAccountDomainNameShort ()
_getAccountFilter (line 478)
  • return: The LDAP search filter for matching directory accounts
  • access: protected
string _getAccountFilter ( $acctname)
  • $acctname
_getAccountFilterFormat (line 438)
  • return: A format string for building an LDAP search filter to match an account
  • access: protected
string _getAccountFilterFormat ()
_getAllowEmptyPassword (line 446)
  • return: Allow empty passwords
  • access: protected
boolean _getAllowEmptyPassword ()
_getBindRequiresDn (line 375)
  • return: Bind requires DN
  • access: protected
boolean _getBindRequiresDn ()
_getChildrenDns (line 1330)

Retrieve the immediate children DNs of the given $parentDn

This method is used in recursive methods like {@see delete()} or {@see copy()}

  • return: of DNs
  • access: protected
array _getChildrenDns (string|Zend_Ldap_Dn $parentDn)
_getHost (line 335)
  • return: The hostname of the LDAP server being used to authenticate accounts
  • access: protected
string _getHost ()
_getOptReferrals (line 462)
  • return: Opt. Referrals
  • access: protected
boolean _getOptReferrals ()
_getPassword (line 367)
  • return: The default password for binding
  • access: protected
string _getPassword ()
_getPort (line 343)
  • return: The port of the LDAP server or 0 to indicate that no port value is set
  • access: protected
int _getPort ()
_getTryUsernameSplit (line 470)
  • return: Try splitting the username into username and domain
  • access: protected
boolean _getTryUsernameSplit ()
_getUsername (line 359)
  • return: The default acctname for binding
  • access: protected
string _getUsername ()
_getUseSsl (line 351)
  • return: The default SSL / TLS encrypted transport control
  • access: protected
boolean _getUseSsl ()
_getUseStartTls (line 454)
  • return: The default SSL / TLS encrypted transport control
  • access: protected
boolean _getUseStartTls ()
_isPossibleAuthority (line 546)
  • access: protected
boolean _isPossibleAuthority (string $dname)
  • string $dname: The domain name to check
_splitName (line 503)
  • access: protected
void _splitName (string $name,  &$dname,  &$aname, string $dname, string $aname)
  • string $name: The name to split
  • string $dname: The resulting domain name (this is an out parameter)
  • string $aname: The resulting account name (this is an out parameter)
  • &$dname
  • &$aname
Class Constants
ACCTNAME_FORM_BACKSLASH = 3 (line 37)
ACCTNAME_FORM_DN = 1 (line 35)
ACCTNAME_FORM_PRINCIPAL = 4 (line 38)
ACCTNAME_FORM_USERNAME = 2 (line 36)
SEARCH_SCOPE_BASE = 3 (line 33)
SEARCH_SCOPE_ONE = 2 (line 32)
SEARCH_SCOPE_SUB = 1 (line 31)

Documentation generated on Mon, 21 Jun 2010 15:30:41 -0400 by phpDocumentor 1.4.3