Ldap.php
Zend Framework
LICENSE
This source file is subject to the new BSD license that is bundled
with this package in the file LICENSE.txt.
It is also available through the world-wide-web at this URL:
http://framework.zend.com/license/new-bsd
If you did not receive a copy of the license and are unable to
obtain it through the world-wide-web, please send an email
to license@zend.com so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Ldap
- Version
- $Id$
Package: Zend_Ldap- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants
Properties



boolean|null|string $_boundUser = falseFALSE if no user is bound to the LDAP resource
NULL if there has been an anonymous bind
username of the currently bound user
Default valuefalseDetails- Type
- boolean | null | string



array $_options = nullThe options used in connecting, binding, etc.
Default valuenullDetails- Type
- array



resource $_resource = nullThe raw LDAP extension resource.
Default valuenullDetails- Type
- resource
Methods



__construct(array | \Zend_Config $options = array()) : voidParameters| Name | Type | Description |
|---|
| $options | array | \Zend_Config | Options used in connecting, binding, etc. |
|---|
Throws 


_getAccount( $acctname, array $attrs = null) : arrayParameters| Name | Type | Description |
|---|
| $acctname | | |
|---|
| $attrs | array | An array of names of desired attributes |
|---|
Returns| Type | Description |
|---|
| array | An array of the attributes representing the account |
Throws 


_getAccountDn(string $acctname) : stringParameters| Name | Type | Description |
|---|
| $acctname | string | The name of the account |
|---|
Returns| Type | Description |
|---|
| string | The DN of the specified account |
Throws 


_getChildrenDns(string | \Zend_Ldap_Dn $parentDn) : arrayRetrieve the immediate children DNs of the given $parentDn
This method is used in recursive methods like {@see delete()}
or {@see copy()}
ParametersReturns| Type | Description |
|---|
| array | of DNs |



_isPossibleAuthority(string $dname) : booleanParameters| Name | Type | Description |
|---|
| $dname | string | The domain name to check |
|---|
Returns 


_splitName(string $name, string $dname, string $aname) : voidParameters| Name | Type | Description |
|---|
| $name | string | The name to split |
|---|
| $dname | string | The resulting domain name (this is an out parameter) |
|---|
| $aname | string | The resulting account name (this is an out parameter) |
|---|



add(string | \Zend_Ldap_Dn $dn, array $entry) : \Zend_LdapAdd new information to the LDAP repository
ParametersReturns| Type | Description |
|---|
| \Zend_Ldap | Provides a fluid interface |
Throws 


bind(string $username = null, string $password = null) : \Zend_LdapParameters| Name | Type | Description |
|---|
| $username | string | The username for authenticating the bind |
|---|
| $password | string | The password for authenticating the bind |
|---|
Returns| Type | Description |
|---|
| \Zend_Ldap | Provides a fluent interface |
Throws 


connect(string $host = null, int $port = null, boolean $useSsl = null, boolean $useStartTls = null) : \Zend_LdapTo 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.
Parameters| Name | Type | Description |
|---|
| $host | string | The hostname of the LDAP server to connect to |
|---|
| $port | int | The port number of the LDAP server to connect to |
|---|
| $useSsl | boolean | Use SSL |
|---|
| $useStartTls | boolean | Use STARTTLS |
|---|
Returns| Type | Description |
|---|
| \Zend_Ldap | Provides a fluent interface |
Throws 


copyToSubtree(string | \Zend_Ldap_Dn $from, string | \Zend_Ldap_Dn $to, boolean $recursively = false) : \Zend_LdapCopies a LDAP entry from one DN to another subtree.
ParametersReturns| Type | Description |
|---|
| \Zend_Ldap | Provides a fluid interface |
Throws 


explodeDn(string $dn, array $keys = null, array $vals = null) : booleanParameters| Name | Type | Description |
|---|
| $dn | string | The DN to parse |
|---|
| $keys | array | An optional array to receive DN keys (e.g. CN, OU, DC, ...) |
|---|
| $vals | array | An optional array to receive DN values |
|---|
Returns| Type | Description |
|---|
| boolean | True if the DN was successfully parsed or false if the string is
not a valid DN. |
Details- Deprecated
- will be removed, use {@see Zend_Ldap_Dn::checkDn()}



filterEscape(string $str) : stringParameters| Name | Type | Description |
|---|
| $str | string | The string to escape. |
|---|
Returns| Type | Description |
|---|
| string | The escaped string |
Details- Deprecated
- will be removed, use {@see Zend_Ldap_Filter_Abstract::escapeValue()}



getBoundUser() : false | null | stringGet 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
Returns| Type | Description |
|---|
| false | null | string | |



getCanonicalAccountName(string $acctname, $form = 0) : stringParameters| Name | Type | Description |
|---|
| $acctname | string | The name to canonicalize |
|---|
| $form | | |
|---|
Returns| Type | Description |
|---|
| string | The canonicalized name in the desired form |
Throws 


getLastError(int $errorCode = null, array $errorMessages = null) : stringReturn the LDAP error message of the last LDAP command
Parameters| Name | Type | Description |
|---|
| $errorCode | int | |
|---|
| $errorMessages | array | |
|---|
Returns 


move(string | \Zend_Ldap_Dn $from, string | \Zend_Ldap_Dn $to, boolean $recursively = false, boolean $alwaysEmulate = false) : \Zend_LdapMoves a LDAP entry from one DN to another DN.
This is an alias for {@link rename()}
ParametersReturns| Type | Description |
|---|
| \Zend_Ldap | Provides a fluid interface |
Throws


moveToSubtree(string | \Zend_Ldap_Dn $from, string | \Zend_Ldap_Dn $to, boolean $recursively = false, boolean $alwaysEmulate = false) : \Zend_LdapMoves a LDAP entry from one DN to another subtree.
ParametersReturns| Type | Description |
|---|
| \Zend_Ldap | Provides a fluid interface |
Throws 


prepareLdapEntryArray(array $entry) : voidstaticPrepares an ldap data entry array for insert/update operation
Parameters| Name | Type | Description |
|---|
| $entry | array | |
|---|
Throws 


rename(string | \Zend_Ldap_Dn $from, string | \Zend_Ldap_Dn $to, boolean $recursively = false, boolean $alwaysEmulate = false) : \Zend_LdapRenames a LDAP entry from one DN to another DN.
This method implicitely moves the entry to another location within the tree.
ParametersReturns| Type | Description |
|---|
| \Zend_Ldap | Provides a fluid interface |
Throws


save(string | \Zend_Ldap_Dn $dn, array $entry) : \Zend_LdapSave entry to LDAP registry.
Internally decides if entry will be updated to added by calling
{@link exists()}.
ParametersReturns| Type | Description |
|---|
| \Zend_Ldap | Provides a fluid interface |
Throws


search(string | \Zend_Ldap_Filter_Abstract | array $filter, string | \Zend_Ldap_Dn | null $basedn = null, integer $scope = self::SEARCH_SCOPE_SUB, array $attributes = array(), string | null $sort = null, string | null $collectionClass = null, integer $sizelimit = 0, integer $timelimit = 0) : \Zend_Ldap_CollectionA 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
- sizelimit
- timelimit
Parameters| Name | Type | Description |
|---|
| $filter | string | \Zend_Ldap_Filter_Abstract | array | |
|---|
| $basedn | string | \Zend_Ldap_Dn | null | |
|---|
| $scope | integer | |
|---|
| $attributes | array | |
|---|
| $sort | string | null | |
|---|
| $collectionClass | string | null | |
|---|
| $sizelimit | integer | |
|---|
| $timelimit | integer | |
|---|
ReturnsThrows


searchEntries(string | \Zend_Ldap_Filter_Abstract | array $filter, string | \Zend_Ldap_Dn | null $basedn = null, integer $scope = self::SEARCH_SCOPE_SUB, array $attributes = array(), string | null $sort = null, boolean $reverseSort = false, integer $sizelimit = 0, integer $timelimit = 0) : arraySearch 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
- sizelimit
- timelimit
Parameters| Name | Type | Description |
|---|
| $filter | string | \Zend_Ldap_Filter_Abstract | array | |
|---|
| $basedn | string | \Zend_Ldap_Dn | null | |
|---|
| $scope | integer | |
|---|
| $attributes | array | |
|---|
| $sort | string | null | |
|---|
| $reverseSort | boolean | |
|---|
| $sizelimit | integer | |
|---|
| $timelimit | integer | |
|---|
ReturnsThrows


setOptions(array | \Zend_Config $options) : \Zend_LdapSets 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
Parameters| Name | Type | Description |
|---|
| $options | array | \Zend_Config | Options used in connecting, binding, etc. |
|---|
Returns| Type | Description |
|---|
| \Zend_Ldap | Provides a fluent interface |
Throws