LDAP
LDAP
LDAP access class
LDAP is the Lightweight Directory Access Protocol, and is a protocol used to access "Directory Servers". The Directory is a special kind of database that holds information in a tree structure.
The concept is similar to your hard disk directory structure, except that in this context, the root directory is "The world" and the first level subdirectories are "countries". Lower levels of the directory structure contain entries for companies, organisations or places, while yet lower still we find directory entries for people, and perhaps equipment or documents.
@module ldap
Properties
conn
public Connection $conn
suffix
private string $suffix
Methods
__construct
LDAP constructor.
public __construct({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$host | string | If you are using OpenLDAP 2.x.x you can specify a URL instead of the hostname. To use LDAP |
with SSL, compile OpenLDAP 2.x.x with SSL support, configure PHP with SSL, and set this parameter as
ldaps://hostname/. |
| $port
| int
| The port to connect to. Not used when using URLs. | | $version
| int
| The LDAP protocol version used to communicate with the server |
setBaseSuffix
Sets the BaseDN suffix to apply to method calls.
public setBaseSuffix({Array})
This suffix is applied to methods that require a baseDN parameter, such as Hazaar\LDAP::search().
Parameters
Parameter | Type | Description |
---|---|---|
$base | string | The base DN to append |
bind
public bind({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$user | string | |
$secret | string |
search
Search LDAP tree.
public search({Array})
Performs the search for a specified filter on the directory with the scope of LDAP_SCOPE_SUBTREE. This is equivalent to searching the entire directory.
Parameters
Parameter | Type | Description |
---|---|---|
$filter | string | The search filter can be simple or advanced, using boolean operators in the format |
described in the LDAP documentation (see the »
[Netscape Directory SDK](http://www.mozilla.org/directory/csdk-docs/filter.htm) for full information on filters). |
| $base
| string
| The base DN for the directory | | $attributes
| array
| An array of the required attributes, e.g. ["mail", "sn", "cn"]. Note that the "dn" is always returned irrespective of which attributes types are requested. Using this parameter is much more efficient than the default action (which is to return all attributes and their associated values). The use of this parameter should therefore be considered good practice. | | $attrsonly
| NULL
| Should be set to 1 if only attribute types are wanted. If set to 0 both attributes types and attribute values are fetched which is the default behaviour. | | $sizelimit
| NULL
| Enables you to limit the count of entries fetched. Setting this to 0 means no limit. p(notice). This parameter can NOT override server-side preset sizelimit. You can set it lower though. Some directory server hosts will be configured to return no more than a preset number of entries. If this occurs, the server will indicate that it has only returned a partial results set. This also occurs if you use this parameter to limit the count of fetched entries. | | $timelimit
| NULL
| Sets the number of seconds how long is spend on the search. Setting this to 0 means no limit. p(notice). This parameter can NOT override server-side preset timelimit. You can set it lower though. | | $deref
| NULL
| Specifies how aliases should be handled during the search. It can be one of the following: * LDAP_DEREF_NEVER - (default) aliases are never dereferenced. * LDAP_DEREF_SEARCHING - aliases should be dereferenced during the search but not when locating the base object of the search. * LDAP_DEREF_FINDING - aliases should be dereferenced when locating the base object but not during the search. * LDAP_DEREF_ALWAYS - aliases should be dereferenced always. | | $
| false
| |
add
Add entries to LDAP directory.
public add({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$dn | string | The distinguished name of an LDAP entity |
$entry | array | An array that specifies the information about the entry. The values in the entries are |
indexed by individual attributes. In case of multiple values for an attribute, they are indexed using integers
starting with 0. |
modify
Modify the existing entries in the LDAP directory.
public modify({Array})
The structure of the entry is same as in Hazaar\LDAP::add().
Parameters
Parameter | Type | Description |
---|---|---|
$dn | string | The distinguished name of an LDAP entity |
$entry | array | An array that specifies the information about the entry. The values in the entries are |
indexed by individual attributes. In case of multiple values for an attribute, they are indexed using integers
starting with 0. |
delete
Delete an entry from a directory.
public delete({Array})
Parameters
Parameter | Type | Description |
---|---|---|
$dn | string | The distinguished name of an LDAP entity |
modAdd
Add attribute values to current attributes.
public modAdd({Array})
Adds one or more attributes to the specified dn. It performs the modification at the attribute level as opposed to the object level. Object-level additions are done by the Hazaar\LDAP::add() function.
Parameters
Parameter | Type | Description |
---|---|---|
$dn | string | The distinguished name of an LDAP entity |
$entry | array |
modReplace
Replace attribute values to current attributes.
public modReplace({Array})
Replaces one or more attributes from the specified dn. It performs the modification at the attribute level as opposed to the object level. Object-level modifications are done by the Hazaar\LDAP::modify() function.
Parameters
Parameter | Type | Description |
---|---|---|
$dn | string | The distinguished name of an LDAP entity |
$entry | array |
modDel
Delete attribute values from current attributes.
public modDel({Array})
Removes one or more attributes from the specified dn. It performs the modification at the attribute level as opposed to the object level. Object-level deletions are done by the Hazaar\LDAP::delete() function.
Parameters
Parameter | Type | Description |
---|---|---|
$dn | string | The distinguished name of an LDAP entity |
$entry | array |
Generated by Hazaar API Doc Generator