Ldap.php
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Ldap
- Version
- $Id$
\Zend_Ldap
- Category
- Zend
- Copyright
- Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Constants
Properties
![>](../images/icons/arrow_right.png)
![Property](../images/icons/property.png)
boolean|null|string $_boundUser = false
false
Details- Type
- boolean | null | string
![>](../images/icons/arrow_right.png)
![Property](../images/icons/property.png)
array $_options = null
null
Details- Type
- array
Methods
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
__construct(array | \Zend_Config $options = array()) : void
Constructor.
Name | Type | Description |
---|---|---|
$options | array | \Zend_Config | Options used in connecting, binding, etc. |
Exception | Description |
---|---|
\Zend_Ldap_Exception | if ext/ldap is not installed |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
_createCollection(\Zend_Ldap_Collection_Iterator_Default $iterator, string | null $collectionClass) : \Zend_Ldap_Collection
Extension point for collection creation
Name | Type | Description |
---|---|---|
$iterator | \Zend_Ldap_Collection_Iterator_Default | |
$collectionClass | string | null |
Type | Description |
---|---|
\Zend_Ldap_Collection |
Exception | Description |
---|---|
\Zend_Ldap_Exception |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
_getAccount( $acctname, array $attrs = null) : array
Name | Type | Description |
---|---|---|
$acctname | ||
$attrs | array | An array of names of desired attributes |
Type | Description |
---|---|
array | An array of the attributes representing the account |
Exception | Description |
---|---|
\Zend_Ldap_Exception |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
_getAccountCanonicalForm() : integer
Type | Description |
---|---|
integer | Either ACCTNAME_FORM_BACKSLASH, ACCTNAME_FORM_PRINCIPAL or ACCTNAME_FORM_USERNAME indicating the form usernames should be canonicalized to. |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
_getAccountDn(string $acctname) : string
Name | Type | Description |
---|---|---|
$acctname | string | The name of the account |
Type | Description |
---|---|
string | The DN of the specified account |
Exception | Description |
---|---|
\Zend_Ldap_Exception |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
_getAccountFilter( $acctname) : string
Name | Type | Description |
---|---|---|
$acctname |
Type | Description |
---|---|
string | The LDAP search filter for matching directory accounts |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
_getAccountFilterFormat() : string
Type | Description |
---|---|
string | A format string for building an LDAP search filter to match an account |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
_getChildrenDns(string | \Zend_Ldap_Dn $parentDn) : array
Retrieve the immediate children DNs of the given $parentDn
Name | Type | Description |
---|---|---|
$parentDn | string | \Zend_Ldap_Dn |
Type | Description |
---|---|
array | of DNs |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
_getHost() : string
Type | Description |
---|---|
string | The hostname of the LDAP server being used to authenticate accounts |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
_getPort() : int
Type | Description |
---|---|
int | The port of the LDAP server or 0 to indicate that no port value is set |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
_getTryUsernameSplit() : boolean
Type | Description |
---|---|
boolean | Try splitting the username into username and domain |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
_getUseSsl() : boolean
Type | Description |
---|---|
boolean | The default SSL / TLS encrypted transport control |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
_getUseStartTls() : boolean
Type | Description |
---|---|
boolean | The default SSL / TLS encrypted transport control |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
_isPossibleAuthority(string $dname) : boolean
Name | Type | Description |
---|---|---|
$dname | string | The domain name to check |
Type | Description |
---|---|
boolean |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
_splitName(string $name, string $dname, string $aname) : void
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) |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
add(string | \Zend_Ldap_Dn $dn, array $entry) : \Zend_Ldap
Add new information to the LDAP repository
Name | Type | Description |
---|---|---|
$dn | string | \Zend_Ldap_Dn | |
$entry | array |
Type | Description |
---|---|
\Zend_Ldap | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
bind(string $username = null, string $password = null) : \Zend_Ldap
Name | Type | Description |
---|---|---|
$username | string | The username for authenticating the bind |
$password | string | The password for authenticating the bind |
Type | Description |
---|---|
\Zend_Ldap | Provides a fluent interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
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.
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 |
Type | Description |
---|---|
\Zend_Ldap | Provides a fluent interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
copy(string | \Zend_Ldap_Dn $from, string | \Zend_Ldap_Dn $to, boolean $recursively = false) : \Zend_Ldap
Copies a LDAP entry from one DN to another DN.
Name | Type | Description |
---|---|---|
$from | string | \Zend_Ldap_Dn | |
$to | string | \Zend_Ldap_Dn | |
$recursively | boolean |
Type | Description |
---|---|
\Zend_Ldap | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
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.
Name | Type | Description |
---|---|---|
$from | string | \Zend_Ldap_Dn | |
$to | string | \Zend_Ldap_Dn | |
$recursively | boolean |
Type | Description |
---|---|
\Zend_Ldap | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
count(string | \Zend_Ldap_Filter_Abstract $filter, string | \Zend_Ldap_Dn | null $basedn = null, integer $scope = self::SEARCH_SCOPE_SUB) : integer
Count items found by given filter.
Name | Type | Description |
---|---|---|
$filter | string | \Zend_Ldap_Filter_Abstract | |
$basedn | string | \Zend_Ldap_Dn | null | |
$scope | integer |
Type | Description |
---|---|
integer |
Exception | Description |
---|---|
\Zend_Ldap_Exception |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
countChildren(string | \Zend_Ldap_Dn $dn) : integer
Count children for a given DN.
Name | Type | Description |
---|---|---|
$dn | string | \Zend_Ldap_Dn |
Type | Description |
---|---|
integer |
Exception | Description |
---|---|
\Zend_Ldap_Exception |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
delete(string | \Zend_Ldap_Dn $dn, boolean $recursively = false) : \Zend_Ldap
Delete an LDAP entry
Name | Type | Description |
---|---|---|
$dn | string | \Zend_Ldap_Dn | |
$recursively | boolean |
Type | Description |
---|---|
\Zend_Ldap | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
exists(string | \Zend_Ldap_Dn $dn) : boolean
Check if a given DN exists.
Name | Type | Description |
---|---|---|
$dn | string | \Zend_Ldap_Dn |
Type | Description |
---|---|
boolean |
Exception | Description |
---|---|
\Zend_Ldap_Exception |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
explodeDn(string $dn, array $keys = null, array $vals = null) : boolean
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 |
Type | Description |
---|---|
boolean | 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()}
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
filterEscape(string $str) : string
Name | Type | Description |
---|---|---|
$str | string | The string to escape. |
Type | Description |
---|---|
string | The escaped string |
- Deprecated
- will be removed, use {@see Zend_Ldap_Filter_Abstract::escapeValue()}
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
getBaseDn() : string
Gets the base DN under which objects of interest are located
Type | Description |
---|---|
string |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
getBaseNode() : \Zend_Ldap_Node
Returns the base node as a Zend_Ldap_Node
Type | Description |
---|---|
\Zend_Ldap_Node |
Exception | Description |
---|---|
\Zend_Ldap_Exception |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
getBoundUser() : false | null | string
Get the currently bound user
Type | Description |
---|---|
false | null | string |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
getCanonicalAccountName(string $acctname, $form = 0) : string
Name | Type | Description |
---|---|---|
$acctname | string | The name to canonicalize |
$form |
Type | Description |
---|---|
string | The canonicalized name in the desired form |
Exception | Description |
---|---|
\Zend_Ldap_Exception |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
getEntry(string | \Zend_Ldap_Dn $dn, array $attributes = array(), boolean $throwOnNotFound = false) : array
Get LDAP entry by DN
Name | Type | Description |
---|---|---|
$dn | string | \Zend_Ldap_Dn | |
$attributes | array | |
$throwOnNotFound | boolean |
Type | Description |
---|---|
array |
Exception | Description |
---|---|
\Zend_Ldap_Exception |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
getLastError(int $errorCode = null, array $errorMessages = null) : string
Return the LDAP error message of the last LDAP command
Name | Type | Description |
---|---|---|
$errorCode | int | |
$errorMessages | array |
Type | Description |
---|---|
string |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
getLastErrorCode() : int
Return the LDAP error number of the last LDAP command
Type | Description |
---|---|
int |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
getNode(string | \Zend_Ldap_Dn $dn) : \Zend_Ldap_Node | null
Returns the specified DN as a Zend_Ldap_Node
Name | Type | Description |
---|---|---|
$dn | string | \Zend_Ldap_Dn |
Type | Description |
---|---|
\Zend_Ldap_Node | null |
Exception | Description |
---|---|
\Zend_Ldap_Exception |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
getRootDse() : \Zend_Ldap_Node_RootDse
Returns the RootDSE
Type | Description |
---|---|
\Zend_Ldap_Node_RootDse |
Exception | Description |
---|---|
\Zend_Ldap_Exception |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
getSchema() : \Zend_Ldap_Node_Schema
Returns the schema
Type | Description |
---|---|
\Zend_Ldap_Node_Schema |
Exception | Description |
---|---|
\Zend_Ldap_Exception |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
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.
Name | Type | Description |
---|---|---|
$from | string | \Zend_Ldap_Dn | |
$to | string | \Zend_Ldap_Dn | |
$recursively | boolean | |
$alwaysEmulate | boolean |
Type | Description |
---|---|
\Zend_Ldap | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
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.
Name | Type | Description |
---|---|---|
$from | string | \Zend_Ldap_Dn | |
$to | string | \Zend_Ldap_Dn | |
$recursively | boolean | |
$alwaysEmulate | boolean |
Type | Description |
---|---|
\Zend_Ldap | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
prepareLdapEntryArray(array $entry) : void
Prepares an ldap data entry array for insert/update operation
Name | Type | Description |
---|---|---|
$entry | array |
Exception | Description |
---|---|
\InvalidArgumentException |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
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.
Name | Type | Description |
---|---|---|
$from | string | \Zend_Ldap_Dn | |
$to | string | \Zend_Ldap_Dn | |
$recursively | boolean | |
$alwaysEmulate | boolean |
Type | Description |
---|---|
\Zend_Ldap | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
save(string | \Zend_Ldap_Dn $dn, array $entry) : \Zend_Ldap
Save entry to LDAP registry.
Name | Type | Description |
---|---|---|
$dn | string | \Zend_Ldap_Dn | |
$entry | array |
Type | Description |
---|---|
\Zend_Ldap | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
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.
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 |
Type | Description |
---|---|
\Zend_Ldap_Collection |
Exception | Description |
---|---|
\Zend_Ldap_Exception |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
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
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 |
Type | Description |
---|---|
array |
Exception | Description |
---|---|
\Zend_Ldap_Exception |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
setOptions(array | \Zend_Config $options) : \Zend_Ldap
Sets the options used in connecting, binding, etc.
Name | Type | Description |
---|---|---|
$options | array | \Zend_Config | Options used in connecting, binding, etc. |
Type | Description |
---|---|
\Zend_Ldap | Provides a fluent interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |
![](../images/icons/arrow_right.png)
![method method](../images/icons/method.png)
update(string | \Zend_Ldap_Dn $dn, array $entry) : \Zend_Ldap
Update LDAP registry
Name | Type | Description |
---|---|---|
$dn | string | \Zend_Ldap_Dn | |
$entry | array |
Type | Description |
---|---|
\Zend_Ldap | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |