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 = false
FALSE if no user is bound to the LDAP resource
NULL if there has been an anonymous bind
username of the currently bound user
Default valuefalse
Details- Type
- boolean | null | string



array $_options = null
The options used in connecting, binding, etc.
Default valuenull
Details- Type
- array



resource $_resource = null
The raw LDAP extension resource.
Default valuenull
Details- Type
- resource
Methods



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


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


_getAccountDn(string $acctname) : string
ParametersName | Type | Description |
---|
$acctname | string | The name of the account |
---|
ReturnsType | Description |
---|
string | The DN of the specified account |
Throws 


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



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


_splitName(string $name, string $dname, string $aname) : void
ParametersName | 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_Ldap
Add new information to the LDAP repository
ParametersReturnsType | Description |
---|
\Zend_Ldap | Provides a fluid interface |
Throws 


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


connect(string $host = null, int $port = null, boolean $useSsl = null, boolean $useStartTls = null) : \Zend_Ldap
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.
ParametersName | 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 |
---|
ReturnsType | Description |
---|
\Zend_Ldap | Provides a fluent interface |
Throws 


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


explodeDn(string $dn, array $keys = null, array $vals = null) : boolean
ParametersName | 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 |
---|
ReturnsType | 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) : string
ParametersName | Type | Description |
---|
$str | string | The string to escape. |
---|
ReturnsType | Description |
---|
string | The escaped string |
Details- Deprecated
- will be removed, use {@see Zend_Ldap_Filter_Abstract::escapeValue()}



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



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


getLastError(int $errorCode = null, array $errorMessages = null) : string
Return the LDAP error message of the last LDAP command
ParametersName | 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_Ldap
Moves a LDAP entry from one DN to another DN.
This is an alias for {@link rename()}
ParametersReturnsType | 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_Ldap
Moves a LDAP entry from one DN to another subtree.
ParametersReturnsType | Description |
---|
\Zend_Ldap | Provides a fluid interface |
Throws 


prepareLdapEntryArray(array $entry) : void
staticPrepares an ldap data entry array for insert/update operation
ParametersName | Type | Description |
---|
$entry | array | |
---|
Throws 


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


save(string | \Zend_Ldap_Dn $dn, array $entry) : \Zend_Ldap
Save entry to LDAP registry.
Internally decides if entry will be updated to added by calling
{@link exists()}.
ParametersReturnsType | 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_Collection
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
- sizelimit
- timelimit
ParametersName | 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) : array
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
- sizelimit
- timelimit
ParametersName | 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_Ldap
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
ParametersName | Type | Description |
---|
$options | array | \Zend_Config | Options used in connecting, binding, etc. |
---|
ReturnsType | Description |
---|
\Zend_Ldap | Provides a fluent interface |
Throws