Zend_Ldap_Node
Zend_Ldap_Node includes the magic propery accessors
__set(), __get(),
__unset() and __isset() to access the
attributes by their name. They proxy to
Zend_Ldap_Node::setAttribute(),
Zend_Ldap_Node::getAttribute(),
Zend_Ldap_Node::deleteAttribute() and
Zend_Ldap_Node::existsAttribute() respectively. Furthermore the
class implements ArrayAccess for array-style-access to the attributes.
Zend_Ldap_Node also implements Iterator and
RecursiveIterato to allow for recursive tree-traversal.
Zend_Ldap_Node API
Method
Description
Zend_Ldap getLdap()
Returns the current LDAP connection. Throws
Zend_Ldap_Exception if current node is in detached
mode (not connected to a Zend_Ldap instance).
Zend_Ldap_Node attachLdap(Zend_Ldap
$ldap)
Attach the current node to the $ldap
Zend_Ldap instance. Throws
Zend_Ldap_Exception if $ldap is
not responsible for the current node (node is not a child of the
$ldap base DN).
Zend_Ldap_Node detachLdap()
Detach node from LDAP connection.
boolean isAttached()
Checks if the current node is attached to a LDAP
connection.
Zend_Ldap_Node
create(string|array|Zend_Ldap_Dn $dn, array $objectClass)
Factory method to create a new detached
Zend_Ldap_Node for a given DN. Creates a new
Zend_Ldap_Node with the DN $dn and
the object-classes $objectClass.
Zend_Ldap_Node
fromLdap(string|array|Zend_Ldap_Dn $dn, Zend_Ldap $ldap)
Factory method to create an attached
Zend_Ldap_Node for a given DN. Loads an existing
Zend_Ldap_Node with the DN $dn
from the LDAP connection $ldap.
Zend_Ldap_Node fromArray((array $data,
boolean $fromDataSource)
Factory method to create a detached
Zend_Ldap_Node from array data
$data. if $fromDataSource is
TRUE (FALSE by default), the data is treated as
beeing present in a LDAP tree.
boolean isNew()
Tells if the node is consiedered as new (not present on the
server). Please note, that this doesn't tell if the node is really
present on the server. Use Zend_Ldap_Node::exists()
to see if a node is already there.
boolean willBeDeleted()
Tells if this node is going to be deleted once
Zend_Ldap_Node::update() is called.
Zend_Ldap_Node delete()
Marks this node as to be deleted. Node will be deleted on
calling Zend_Ldap_Node::update() if
Zend_Ldap_Node::willBeDeleted() is true.
boolean willBeMoved()
Tells if this node is going to be moved once
Zend_Ldap_Node::update() is called.
Zend_Ldap_Node update(Zend_Ldap $ldap)
Sends all pending changes to the LDAP server. If
$ldap is omitted the current LDAP
connection is used. If the current node is detached from a
LDAP connection a
Zend_Ldap_Exception will be thrown. If
$ldap is provided the current node will be attached to
the given LDAP connection.
Zend_Ldap_Dn getCurrentDn()
Gets the current DN of the current node as a Zend_Ldap_Dn.
This does not reflect possible rename-operations.
Zend_Ldap_Dn getDn()
Gets the original DN of the current node as a Zend_Ldap_Dn.
This reflects possible rename-operations.
string getDnString(string $caseFold)
Gets the original DN of the current node as a string. This
reflects possible rename-operations.
array getDnArray(string $caseFold)
Gets the original DN of the current node as an array. This
reflects possible rename-operations.
string getRdnString(string $caseFold)
Gets the RDN of the current node as a string. This
reflects possible rename-operations.
array getRdnArray(string $caseFold)
Gets the RDN of the current node as an array. This
reflects possible rename-operations.
Zend_Ldap_Node setDn(Zend_Ldap_Dn|string|array
$newDn)
Sets the new DN for this node effectively moving the node
once Zend_Ldap_Node::update() is called.
Zend_Ldap_Node move(Zend_Ldap_Dn|string|array
$newDn)
This is an alias for
Zend_Ldap_Node::setDn().
Zend_Ldap_Node rename(Zend_Ldap_Dn|string|array
$newDn)
This is an alias for
Zend_Ldap_Node::setDn().
array getObjectClass()
Returns the objectClass of the node.
Zend_Ldap_Node setObjectClass(array|string
$value)
Sets the objectClass attribute.
Zend_Ldap_Node appendObjectClass(array|string
$value)
Appends to the objectClass attribute.
string toLdif(array $options)
Returns a LDIF representation of the current node.
$options will be passed to the
Zend_Ldap_Ldif_Encoder.
array getChangedData()
Gets changed node data. The array contains all changed
attributes. This format can be used in
Zend_Ldap::add() and
Zend_Ldap::update().
array getChanges()
Returns all changes made.
string toString()
Returns the DN of the current node - proxies to
Zend_Ldap_Dn::getDnString().
string __toString()
Casts to string representation - proxies to
Zend_Ldap_Dn::toString().
array toArray(boolean
$includeSystemAttributes)
Returns an array representation of the current node. If
$includeSystemAttributes is FALSE
(defaults to TRUE) the system specific attributes are
stripped from the array. Unlike
Zend_Ldap_Node::getAttributes() the resulting array
contains the DN with key 'dn'.
string toJson(boolean
$includeSystemAttributes)
Gibt eine JSON Repräsentation des aktuellen Nodes zurück
wobei Zend_Ldap_Node::toArray() verwendet wird.
array getData(boolean
$includeSystemAttributes)
Gibt die Attribute des Nodes zurück. Das Array enthält alle Attribute in Ihrem
internen Format (keine Konvertierung).
boolean existsAttribute(string $name, boolean
$emptyExists)
Prüft ob ein angegebenes Attribut existiert. Wenn
$emptyExists FALSE ist werden leere
Attrbute (welche nur array() enthalten) als nicht-existent betrachtet und es
wird FALSE zurückgegeben. Wenn
$emptyExists true ist werden leere Attribute als existent
betrachtet und es wird TRUE zurückgegeben. In diesem
Fall gibt die Methode nur dann FALSE zurck wenn der
Name des Attributs in der Sammlung der Schlüssel fehlt.
boolean attributeHasValue(string $name, mixed|array
$value)
Prüft ob die angegebenen Werte im Attribut existieren. Die Methode gibt nur
dann TRUE zurück wenn alle Werte von
$value im Attribut vorhanden sind. Der Vergleich wird
strikt durchgeführt (er respektiert den Datentyp).
integer count()
Gibt die Anzahl der Attribute im Node zurück. Implementiert Countable.
mixed getAttribute(string $name, integer|null
$index)
Holt ein LDAP Attribut. Die Datenkonvertierung wird
angewendet durch Verwendung von
Zend_Ldap_Attribute::getAttribute().
array getAttributes(boolean
$includeSystemAttributes)
Holt alle Attribute des Nodes. Wenn
$includeSystemAttributes FALSE ist
(der Standardwert ist TRUE) dann werden die System
spezifischen Attribute vom Array entfernt.
Zend_Ldap_Node setAttribute(string $name, mixed
$value)
Setzt ein LDAP Attribut. Die Datenkonvertierung wird
angewendet durch Verwendung von
Zend_Ldap_Attribute::setAttribute().
Zend_Ldap_Node appendToAttribute(string $name, mixed
$value)
Hängt etwas an ein LDAP Attribut an. Die
Datenkonvertierung wird angewendet durch Verwendung von
Zend_Ldap_Attribute::setAttribute().
array|integer getDateTimeAttribute(string $name,
integer|null $index)
Holt ein LDAP Date/Time Attribut. Die Datenkonvertierung
wird angewendet durch Verwendung von
Zend_Ldap_Attribute::setDateTimeAttribute().
Zend_Ldap_Node setDateTimeAttribute(string $name,
integer|array $value, boolean $utc)
Setzt ein LDAP Date/Time Attribut. Die Datenkonvertierung
wird angewendet durch Verwendung von
Zend_Ldap_Attribute::setDateTimeAttribute().
Zend_Ldap_Node appendToDateTimeAttribute(string $name,
integer|array $value, boolean $utc)
Hängt etwas an ein LDAP Date/Time Attribut an. Die
Datenkonvertierung wird angewendet durch Verwendung von
Zend_Ldap_Attribute::setDateTimeAttribute().
Zend_Ldap_Node setPasswordAttribute(string $password,
string $hashType, string $attribName)
Setzt ein LDAP Passwort bei
$attribName (der Standardwert ist
'userPassword') auf $password mit dem
Hashtyp $hashType (der Standardwert ist
Zend_Ldap_Attribute::PASSWORD_HASH_MD5).
Zend_Ldap_Node deleteAttribute(string
$name)
Löscht ein LDAP Attribut.
void removeDuplicatesFromAttribute(string
$name)
Entfernt doppelte Werte von einem LDAP Attribut.
void removeFromAttribute(string $attribName,
mixed|array $value)
Entfernt die angegebenen Werte von einem LDAP Attribut.
boolean exists(Zend_Ldap $ldap)
Prüft ob der aktuelle Node im angegebenen LDAP Server
existiert (der aktuelle Server wird verwendet wenn
NULL übergeben wird).
Zend_Ldap_Node reload(Zend_Ldap $ldap)
Lädt die Attribute des aktuellen Nodes nochmalig vom angegebenen
LDAP Server (der aktuelle Server wird verwendet wenn
NULL übergeben wird).
Zend_Ldap_Node_Collection
searchSubtree(string|Zend_Ldap_Filter_Abstract $filter, integer
$scope, string $sort)
Sucht den Unterbaum des Nodes mit dem angegebenen $filter
und den angegebenen Suchparametern ab. Siehe
Zend_Ldap::search() für Details über die
Parameter $scope und $sort.
integer countSubtree(string|Zend_Ldap_Filter_Abstract
$filter, integer $scope)
Zählt die Elemente des Unterbaums vom Node welche dem angegebenen
$filter entsprechen und dem angegebenen Suchbereich.
Siehe Zend_Ldap::search() für Details über den
$scope Parameter.
integer countChildren()
Zählt die Kinder des Nodes.
Zend_Ldap_Node_Collection
searchChildren(string|Zend_Ldap_Filter_Abstract $filter, string
$sort)
Sucht nach Kindern des Nodes die dem angegebenen $filter
entsprechen. Siehe Zend_Ldap::search() für Details
über den $sort Parameter.
boolean hasChildren()
Gibt zurück ob der aktuelle Node Kinder hat.
Zend_Ldap_Node_ChildrenIterator
getChildren()
Gibt alle Kinder des aktuellen Nodes zurück.
Zend_Ldap_Node getParent(Zend_Ldap
$ldap)
Gibt den Elternteil des aktuellen Nodes zurück wobei die
LDAP Verbindung $ldap verwendet wird
(verwendet die aktuelle LDAP Verbindung wenn diese nicht
angegeben wird).