Ldap/Node.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 [email protected] so we can send you a copy immediately.
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
- Package
- Zend_Ldap
- Subpackage
- Node
- Version
- $Id: Node.php 24610 2012-01-21 13:54:27Z sgehrig $
\Zend_Ldap_Node
Zend_Ldap_Node provides an object oriented view into a LDAP node.
- Implements
- Parent(s)
- \Zend_Ldap_Node_Abstract
- Category
- Zend
- Copyright
- Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
- License
- New BSD License
Properties

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

$_systemAttributes = array('createtimestamp', 'creatorsname', 'entrycsn', 'entrydn', 'entryuuid', 'hassubordinates', 'modifiersname', 'modifytimestamp', 'structuralobjectclass', 'subschemasubentry', 'distinguishedname', 'instancetype', 'name', 'objectcategory', 'objectguid', 'usnchanged', 'usncreated', 'whenchanged', 'whencreated')
array('createtimestamp', 'creatorsname', 'entrycsn', 'entrydn', 'entryuuid', 'hassubordinates', 'modifiersname', 'modifytimestamp', 'structuralobjectclass', 'subschemasubentry', 'distinguishedname', 'instancetype', 'name', 'objectcategory', 'objectguid', 'usnchanged', 'usncreated', 'whenchanged', 'whencreated')Details- Type
- n/a
- Inherited_from
- \Zend_Ldap_Node_Abstract::$$_systemAttributes
Methods

__construct(\Zend_Ldap_Dn $dn, array $data, boolean $fromDataSource, \Zend_Ldap $ldap = null) : voidConstructor.
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 |

__get(string $name) : array
This is an offline method.
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| array |
| Exception | Description |
|---|---|
| \Zend_Ldap_Exception |

__isset(string $name) : booleanChecks whether a given attribute exists.
Inherited from: \Zend_Ldap_Node_Abstract::__isset()Empty attributes will be treated as non-existent.
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| boolean |

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

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

__toString() : stringCast to string representation {@see toString()}
Inherited from: \Zend_Ldap_Node_Abstract::__toString()| Type | Description |
|---|---|
| string |

__unset(string $name) : nullDeletes 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) : voidEnsures that teh RDN attributes are correctly set.
| Name | Type | Description |
|---|---|---|
| $overwrite | boolean | True to overwrite the RDN attributes |

_getDn() : \Zend_Ldap_DnGets 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) : voidMarks 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) : voidMarks this node as to be deleted.
Node will be deleted on calling update() if $delete is true.
| Name | Type | Description |
|---|---|---|
| $delete | boolean |

_postDelete() : voidAllows post-delete logic to be applied to node.
Subclasses may override this method.

_postRename() : voidAllows post-rename logic to be applied to node.
Subclasses may override this method.

_postUpdate() : voidAllows post-update logic to be applied to node.
Subclasses may override this method.

_preDelete() : voidAllows pre-delete logic to be applied to node.
Subclasses may override this method.

_preRename() : voidAllows pre-rename logic to be applied to node.
Subclasses may override this method.

_preUpdate() : voidAllows pre-update logic to be applied to node.
Subclasses may override this method.

_setAttribute(string $name, mixed $value, boolean $append) : voidChecks 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) : voidChecks 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_NodeAppends 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_NodeAppends 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_NodeAppends 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_NodeAttach 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 |
- Uses
- \global\Zend_Ldap_Dn::isChildOf()

attributeHasValue(string $attribName, mixed | array $value) : booleanChecks if the given value(s) exist in the attribute
Inherited from: \Zend_Ldap_Node_Abstract::attributeHasValue()| Name | Type | Description |
|---|---|---|
| $attribName | string | |
| $value | mixed | array |
| Type | Description |
|---|---|
| boolean |

count() : intReturns the number of attributes in node.
Inherited from: \Zend_Ldap_Node_Abstract::count()Implements Countable
| Type | Description |
|---|---|
| int |

countChildren() : integerCount 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) : integerCount 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_NodeFactory 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_NodeMarks 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_NodeDeletes 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_NodeDetach node from LDAP connection
This is an offline method.
| Type | Description |
|---|---|
| \Zend_Ldap_Node | Provides a fluid interface |

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

existsAttribute(string $name, boolean $emptyExists = false) : booleanChecks whether a given attribute exists.
Inherited from: \Zend_Ldap_Node_Abstract::existsAttribute()If $emptyExists is false empty attributes (containing only array()) are treated as non-existent returning false. If $emptyExists is true empty attributes are treated as existent returning true. In this case method returns false only if the attribute name is missing in the key-collection.
| Name | Type | Description |
|---|---|---|
| $name | string | |
| $emptyExists | boolean |
| Type | Description |
|---|---|
| boolean |

fromArray(array $data, boolean $fromDataSource = false) : \Zend_Ldap_NodeFactory 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 | nullFactory 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 |

getAttribute(string $name, integer $index = null) : mixed
This is an offline method.
| Name | Type | Description |
|---|---|---|
| $name | string | |
| $index | integer |
| Type | Description |
|---|---|
| mixed |
| Exception | Description |
|---|---|
| \Zend_Ldap_Exception |

getAttributes(boolean $includeSystemAttributes = true) : array
The collection contains all attributes.
This is an offline method.
| Name | Type | Description |
|---|---|---|
| $includeSystemAttributes | boolean |
| Type | Description |
|---|---|
| array |

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

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

getChildren() : \Zend_Ldap_Node_ChildrenIteratorReturns 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_DnGets 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 |

getData(boolean $includeSystemAttributes = true) : array
The array contains all attributes in its internal format (no conversion).
This is an offline method.
| Name | Type | Description |
|---|---|---|
| $includeSystemAttributes | boolean |
| Type | Description |
|---|---|
| array |

getDateTimeAttribute(string $name, integer $index = null) : array | integerGets a LDAP date/time attribute.
Inherited from: \Zend_Ldap_Node_Abstract::getDateTimeAttribute()This is an offline method.
| Name | Type | Description |
|---|---|---|
| $name | string | |
| $index | integer |
| Type | Description |
|---|---|
| array | integer |
| Exception | Description |
|---|---|
| \Zend_Ldap_Exception |

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

getDnArray(string $caseFold = null) : arrayGets the DN of the current node as an array.
Inherited from: \Zend_Ldap_Node_Abstract::getDnArray()This is an offline method.
| Name | Type | Description |
|---|---|---|
| $caseFold | string |
| Type | Description |
|---|---|
| array |

getDnString(string $caseFold = null) : stringGets the DN of the current node as a string.
Inherited from: \Zend_Ldap_Node_Abstract::getDnString()This is an offline method.
| Name | Type | Description |
|---|---|---|
| $caseFold | string |
| Type | Description |
|---|---|
| string |

getLdap() : \Zend_LdapGets the current LDAP connection.
| Type | Description |
|---|---|
| \Zend_Ldap |
| Exception | Description |
|---|---|
| \Zend_Ldap_Exception |

getObjectClass() : arrayGets the objectClass of the node
Inherited from: \Zend_Ldap_Node_Abstract::getObjectClass()| Type | Description |
|---|---|
| array |

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

getRdnArray(string $caseFold = null) : arrayGets the RDN of the current node as an array.
Inherited from: \Zend_Ldap_Node_Abstract::getRdnArray()This is an offline method.
| Name | Type | Description |
|---|---|---|
| $caseFold | string |
| Type | Description |
|---|---|
| array |

getRdnString(string $caseFold = null) : stringGets the RDN of the current node as a string.
Inherited from: \Zend_Ldap_Node_Abstract::getRdnString()This is an offline method.
| Name | Type | Description |
|---|---|---|
| $caseFold | string |
| Type | Description |
|---|---|
| string |

hasChildren() : booleanChecks 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() : booleanChecks if the current node is attached to a LDAP server.
This is an offline method.
| Type | Description |
|---|---|
| boolean |

isNew() : booleanTells 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 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 |

offsetExists(string $name) : booleanChecks whether a given attribute exists.
Inherited from: \Zend_Ldap_Node_Abstract::offsetExists()Implements ArrayAccess.
Empty attributes will be treated as non-existent.
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| boolean |

offsetGet(string $name) : array
Implements ArrayAccess.
This is an offline method.
| Name | Type | Description |
|---|---|---|
| $name | string |
| Type | Description |
|---|---|
| array |
| Exception | Description |
|---|---|
| \Zend_Ldap_Exception |

offsetSet(string $name, mixed $value) : nullSets 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) : nullDeletes 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_NodeReload 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) : voidRemoves duplicate values from a LDAP attribute
| Name | Type | Description |
|---|---|---|
| $attribName | string |

removeFromAttribute(string $attribName, mixed | array $value) : voidRemove 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_CollectionGets 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_CollectionSearch 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_NodeSets 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_NodeSets 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_NodeSets 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_NodeSets 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_NodeSets 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 |

toArray(boolean $includeSystemAttributes = true) : arrayReturns an array representation of the current node
Inherited from: \Zend_Ldap_Node_Abstract::toArray()| Name | Type | Description |
|---|---|---|
| $includeSystemAttributes | boolean |
| Type | Description |
|---|---|
| array |

toJson(boolean $includeSystemAttributes = true) : stringReturns a JSON representation of the current node
Inherited from: \Zend_Ldap_Node_Abstract::toJson()| Name | Type | Description |
|---|---|---|
| $includeSystemAttributes | boolean |
| Type | Description |
|---|---|
| string |

toLdif(array $options = array()) : stringReturns 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_NodeSends 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() : booleanCheck if there is a current attribute after calls to rewind() or next().
Implements Iterator
| Type | Description |
|---|---|
| boolean |

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