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.
Zend_Ldap_Node provides an object oriented view into a LDAP node.

\Zend_Ldap
$_ldap= ''
Holds the connection to the LDAP server if in connected mode.

__construct(
\Zend_Ldap_Dn $dn, array $data, boolean $fromDataSource, \Zend_Ldap $ldap
=
null
)
:
void
Constructor.
Constructor is protected to enforce the use of factory methods.
Name | Type | Description |
---|---|---|
$dn | \Zend_Ldap_Dn | |
$data | array | |
$fromDataSource | boolean | |
$ldap | \Zend_Ldap |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

__set(
string $name, mixed $value
)
:
null
Sets a LDAP attribute.
This is an offline method.
Name | Type | Description |
---|---|---|
$name | string | |
$value | mixed |
Type | Description |
---|---|
null |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

__sleep(
)
:
array
Serialization callback
Only DN and attributes will be serialized.
Type | Description |
---|---|
array |

__unset(
string $name
)
:
null
Deletes a LDAP attribute.
This method deletes the attribute.
This is an offline method.
Name | Type | Description |
---|---|---|
$name | string |
Type | Description |
---|---|
null |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

_assertChangeableAttribute(
string $name
)
:
boolean
Name | Type | Description |
---|---|---|
$name | string |
Type | Description |
---|---|
boolean |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

_ensureRdnAttributeValues(
boolean $overwrite
=
false
)
:
void
Ensures that teh RDN attributes are correctly set.
Name | Type | Description |
---|---|---|
$overwrite | boolean | True to overwrite the RDN attributes |

_getDn(
)
:
\Zend_Ldap_Dn
Gets the DN of the current node as a Zend_Ldap_Dn.
This is an offline method.
Type | Description |
---|---|
\Zend_Ldap_Dn |

_loadData(
array $data, boolean $fromDataSource
)
:
void
Name | Type | Description |
---|---|---|
$data | array | |
$fromDataSource | boolean |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

_markAsNew(
boolean $new
)
:
void
Marks this node as new.
Node will be added (instead of updated) on calling update() if $new is true.
Name | Type | Description |
---|---|---|
$new | boolean |

_markAsToBeDeleted(
boolean $delete
)
:
void
Marks this node as to be deleted.
Node will be deleted on calling update() if $delete is true.
Name | Type | Description |
---|---|---|
$delete | boolean |

_setAttribute(
string $name, mixed $value, boolean $append
)
:
void
Checks if the attribute can be set and sets it accordingly.
Name | Type | Description |
---|---|---|
$name | string | |
$value | mixed | |
$append | boolean |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

_setDateTimeAttribute(
string $name, integer|array $value, boolean $utc, boolean $append
)
:
void
Checks if the attribute can be set and sets it accordingly.
Name | Type | Description |
---|---|---|
$name | string | |
$value | integer|array | |
$utc | boolean | |
$append | boolean |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

appendObjectClass(
array|string $value
)
:
\Zend_Ldap_Node
Appends to the objectClass.
This is an offline method.
Name | Type | Description |
---|---|---|
$value | array|string |
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

appendToAttribute(
string $name, mixed $value
)
:
\Zend_Ldap_Node
Appends to a LDAP attribute.
This is an offline method.
Name | Type | Description |
---|---|---|
$name | string | |
$value | mixed |
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

appendToDateTimeAttribute(
string $name, integer|array $value, boolean $utc
=
false
)
:
\Zend_Ldap_Node
Appends to a LDAP date/time attribute.
This is an offline method.
Name | Type | Description |
---|---|---|
$name | string | |
$value | integer|array | |
$utc | boolean |
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

attachLdap(
\Zend_Ldap $ldap
)
:
\Zend_Ldap_Node
Attach node to an LDAP connection
This is an offline method.
Name | Type | Description |
---|---|---|
$ldap | \Zend_Ldap |
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

countChildren(
)
:
integer
Count children of current node.
This is an online method.
Type | Description |
---|---|
integer |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

countSubtree(
string|\Zend_Ldap_Filter_Abstract $filter, integer $scope
=
Zend_Ldap::SEARCH_SCOPE_SUB
)
:
integer
Count items in current subtree found by given filter.
This is an online method.
Name | Type | Description |
---|---|---|
$filter | string|\Zend_Ldap_Filter_Abstract | |
$scope | integer |
Type | Description |
---|---|
integer |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

create(
string|array|\Zend_Ldap_Dn $dn, array $objectClass
=
array()
)
:
\Zend_Ldap_Node
Factory method to create a new detached Zend_Ldap_Node for a given DN.
Name | Type | Description |
---|---|---|
$dn | string|array|\Zend_Ldap_Dn | |
$objectClass | array |
Type | Description |
---|---|
\Zend_Ldap_Node |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

delete(
)
:
\Zend_Ldap_Node
Marks this node as to be deleted
Node will be deleted on calling update() if $delete is true.
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |

deleteAttribute(
string $name
)
:
\Zend_Ldap_Node
Deletes a LDAP attribute.
This method deletes the attribute.
This is an offline method.
Name | Type | Description |
---|---|---|
$name | string |
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

detachLdap(
)
:
\Zend_Ldap_Node
Detach node from LDAP connection
This is an offline method.
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |

exists(
\Zend_Ldap $ldap
=
null
)
:
boolean
Check if node exists on LDAP.
This is an online method.
Name | Type | Description |
---|---|---|
$ldap | \Zend_Ldap |
Type | Description |
---|---|
boolean |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

fromArray(
array $data, boolean $fromDataSource
=
false
)
:
\Zend_Ldap_Node
Factory method to create a detached Zend_Ldap_Node from array data.
Name | Type | Description |
---|---|---|
$data | array | |
$fromDataSource | boolean |
Type | Description |
---|---|
\Zend_Ldap_Node |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

fromLdap(
string|array|\Zend_Ldap_Dn $dn, \Zend_Ldap $ldap
)
:
\Zend_Ldap_Node|null
Factory method to create an attached Zend_Ldap_Node for a given DN.
Name | Type | Description |
---|---|---|
$dn | string|array|\Zend_Ldap_Dn | |
$ldap | \Zend_Ldap |
Type | Description |
---|---|
\Zend_Ldap_Node|null |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

getChangedData(
)
:
array
Gets changed node data.
The array contains all changed attributes. This format can be used in {@link Zend_Ldap::add()} and {@link Zend_Ldap::update()}.
This is an offline method.
Type | Description |
---|---|
array |

getChanges(
)
:
array
Returns all changes made.
This is an offline method.
Type | Description |
---|---|
array |

getChildren(
)
:
\Zend_Ldap_Node_ChildrenIterator
Returns the children for the current node.
Can be used offline but returns an empty array if children have not been retrieved yet.
Type | Description |
---|---|
\Zend_Ldap_Node_ChildrenIterator |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

getCurrentDn(
)
:
\Zend_Ldap_Dn
Gets the current DN of the current node as a Zend_Ldap_Dn.
The method returns a clone of the node's DN to prohibit modification.
This is an offline method.
Type | Description |
---|---|
\Zend_Ldap_Dn |

getParent(
\Zend_Ldap $ldap
=
null
)
:
\Zend_Ldap_Node
Returns the parent of the current node.
Name | Type | Description |
---|---|---|
$ldap | \Zend_Ldap |
Type | Description |
---|---|
\Zend_Ldap_Node |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

hasChildren(
)
:
boolean
Checks if current node has children.
Returns whether the current element has children.
Can be used offline but returns false if children have not been retrieved yet.
Type | Description |
---|---|
boolean |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

isAttached(
)
:
boolean
Checks if the current node is attached to a LDAP server.
This is an offline method.
Type | Description |
---|---|
boolean |

isNew(
)
:
boolean
Tells if the node is consiedered as new (not present on the server)
Please note, that this doesn't tell you if the node is present on the server. Use {@link exits()} to see if a node is already there.
Type | Description |
---|---|
boolean |

move(
\Zend_Ldap_Dn|string|array $newDn
)
:
\Zend_Ldap_Node
{@see setDn()}
This is an offline method.
Name | Type | Description |
---|---|---|
$newDn | \Zend_Ldap_Dn|string|array |
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

offsetSet(
string $name, mixed $value
)
:
null
Sets a LDAP attribute.
Implements ArrayAccess.
This is an offline method.
Name | Type | Description |
---|---|---|
$name | string | |
$value | mixed |
Type | Description |
---|---|
null |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

offsetUnset(
string $name
)
:
null
Deletes a LDAP attribute.
Implements ArrayAccess.
This method deletes the attribute.
This is an offline method.
Name | Type | Description |
---|---|---|
$name | string |
Type | Description |
---|---|
null |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

reload(
\Zend_Ldap $ldap
=
null
)
:
\Zend_Ldap_Node
Reload node attributes from LDAP.
This is an online method.
Name | Type | Description |
---|---|---|
$ldap | \Zend_Ldap |
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

removeDuplicatesFromAttribute(
string $attribName
)
:
void
Removes duplicate values from a LDAP attribute
Name | Type | Description |
---|---|---|
$attribName | string |

removeFromAttribute(
string $attribName, mixed|array $value
)
:
void
Remove given values from a LDAP attribute
Name | Type | Description |
---|---|---|
$attribName | string | |
$value | mixed|array |

rename(
\Zend_Ldap_Dn|string|array $newDn
)
:
\Zend_Ldap_Node
{@see setDn()}
This is an offline method.
Name | Type | Description |
---|---|---|
$newDn | \Zend_Ldap_Dn|string|array |
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

searchChildren(
string|\Zend_Ldap_Filter_Abstract $filter, string $sort
=
null
)
:
\Zend_Ldap_Node_Collection
Gets children of current node.
This is an online method.
Name | Type | Description |
---|---|---|
$filter | string|\Zend_Ldap_Filter_Abstract | |
$sort | string |
Type | Description |
---|---|
\Zend_Ldap_Node_Collection |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

searchSubtree(
string|\Zend_Ldap_Filter_Abstract $filter, integer $scope
=
Zend_Ldap::SEARCH_SCOPE_SUB, string $sort
=
null
)
:
\Zend_Ldap_Node_Collection
Search current subtree with given options.
This is an online method.
Name | Type | Description |
---|---|---|
$filter | string|\Zend_Ldap_Filter_Abstract | |
$scope | integer | |
$sort | string |
Type | Description |
---|---|
\Zend_Ldap_Node_Collection |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

setAttribute(
string $name, mixed $value
)
:
\Zend_Ldap_Node
Sets a LDAP attribute.
This is an offline method.
Name | Type | Description |
---|---|---|
$name | string | |
$value | mixed |
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

setDateTimeAttribute(
string $name, integer|array $value, boolean $utc
=
false
)
:
\Zend_Ldap_Node
Sets a LDAP date/time attribute.
This is an offline method.
Name | Type | Description |
---|---|---|
$name | string | |
$value | integer|array | |
$utc | boolean |
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

setDn(
\Zend_Ldap_Dn|string|array $newDn
)
:
\Zend_Ldap_Node
Sets the new DN for this node
This is an offline method.
Name | Type | Description |
---|---|---|
$newDn | \Zend_Ldap_Dn|string|array |
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

setObjectClass(
array|string $value
)
:
\Zend_Ldap_Node
Sets the objectClass.
This is an offline method.
Name | Type | Description |
---|---|---|
$value | array|string |
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

setPasswordAttribute(
string $password, string $hashType
=
Zend_Ldap_Attribute::PASSWORD_HASH_MD5, string $attribName
=
'userPassword'
)
:
\Zend_Ldap_Node
Sets a LDAP password.
Name | Type | Description |
---|---|---|
$password | string | |
$hashType | string | |
$attribName | string |
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

toLdif(
array $options
=
array()
)
:
string
Returns a LDIF representation of the current node
Name | Type | Description |
---|---|---|
$options | array | Additional options used during encoding |
Type | Description |
---|---|
string |

update(
\Zend_Ldap $ldap
=
null
)
:
\Zend_Ldap_Node
Sends all pending changes to the LDAP server
Name | Type | Description |
---|---|---|
$ldap | \Zend_Ldap |
Type | Description |
---|---|
\Zend_Ldap_Node | Provides a fluid interface |
Exception | Description |
---|---|
\Zend_Ldap_Exception |

valid(
)
:
boolean
Check if there is a current attribute after calls to rewind() or next().
Implements Iterator
Type | Description |
---|---|
boolean |

willBeDeleted(
)
:
boolean
Is this node going to be deleted once update() is called?
Type | Description |
---|---|
boolean |