Zend_Ldap-API-Ldap-Node.xml 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- Reviewed: no -->
  3. <sect3 id="zend.ldap.api.reference.zend-ldap-node">
  4. <title>Zend_Ldap_Node</title>
  5. <para>
  6. <classname>Zend_Ldap_Node</classname> includes the magic property accessors
  7. <methodname>__set()</methodname>, <methodname>__get()</methodname>,
  8. <methodname>__unset()</methodname> and <methodname>__isset()</methodname> to access the
  9. attributes by their name. They proxy to
  10. <methodname>Zend_Ldap_Node::setAttribute()</methodname>,
  11. <methodname>Zend_Ldap_Node::getAttribute()</methodname>,
  12. <methodname>Zend_Ldap_Node::deleteAttribute()</methodname> and
  13. <methodname>Zend_Ldap_Node::existsAttribute()</methodname> respectively. Furthermore the
  14. class implements <code>ArrayAccess</code> for array-style-access to the attributes.
  15. <classname>Zend_Ldap_Node</classname> also implements <code>Iterator</code> and
  16. <code>RecursiveIterato</code> to allow for recursive tree-traversal.
  17. </para>
  18. <table id="zend.ldap.api.reference.zend-ldap-node.table">
  19. <title>Zend_Ldap_Node API</title>
  20. <tgroup cols="2">
  21. <thead>
  22. <row>
  23. <entry>Method</entry>
  24. <entry>Description</entry>
  25. </row>
  26. </thead>
  27. <tbody>
  28. <row>
  29. <entry><code>Zend_Ldap getLdap()</code></entry>
  30. <entry>
  31. Returns the current <acronym>LDAP</acronym> connection. Throws
  32. <classname>Zend_Ldap_Exception</classname> if current node is in detached
  33. mode (not connected to a <classname>Zend_Ldap</classname> instance).
  34. </entry>
  35. </row>
  36. <row>
  37. <entry><code>Zend_Ldap_Node attachLdap(Zend_Ldap $ldap)</code></entry>
  38. <entry>
  39. Attach the current node to the <varname>$ldap</varname>
  40. <classname>Zend_Ldap</classname> instance. Throws
  41. <classname>Zend_Ldap_Exception</classname> if <varname>$ldap</varname> is
  42. not responsible for the current node (node is not a child of the
  43. <varname>$ldap</varname> base DN).
  44. </entry>
  45. </row>
  46. <row>
  47. <entry><code>Zend_Ldap_Node detachLdap()</code></entry>
  48. <entry>Detach node from <acronym>LDAP</acronym> connection.</entry>
  49. </row>
  50. <row>
  51. <entry><code>boolean isAttached()</code></entry>
  52. <entry>
  53. Checks if the current node is attached to a <acronym>LDAP</acronym>
  54. connection.
  55. </entry>
  56. </row>
  57. <row>
  58. <entry>
  59. <emphasis><code>Zend_Ldap_Node create(string|array|Zend_Ldap_Dn $dn, array
  60. $objectClass)</code></emphasis>
  61. </entry>
  62. <entry>
  63. Factory method to create a new detached
  64. <classname>Zend_Ldap_Node</classname> for a given DN. Creates a new
  65. <classname>Zend_Ldap_Node</classname> with the DN <varname>$dn</varname> and
  66. the object-classes <varname>$objectClass</varname>.
  67. </entry>
  68. </row>
  69. <row>
  70. <entry>
  71. <emphasis><code>Zend_Ldap_Node fromLdap(string|array|Zend_Ldap_Dn $dn,
  72. Zend_Ldap $ldap)</code></emphasis>
  73. </entry>
  74. <entry>
  75. Factory method to create an attached
  76. <classname>Zend_Ldap_Node</classname> for a given DN. Loads an existing
  77. <classname>Zend_Ldap_Node</classname> with the DN <varname>$dn</varname>
  78. from the <acronym>LDAP</acronym> connection <varname>$ldap</varname>.
  79. </entry>
  80. </row>
  81. <row>
  82. <entry>
  83. <emphasis><code>Zend_Ldap_Node fromArray((array $data,
  84. boolean $fromDataSource)</code></emphasis>
  85. </entry>
  86. <entry>
  87. Factory method to create a detached <classname>Zend_Ldap_Node</classname>
  88. from array data <varname>$data</varname>. if
  89. <varname>$fromDataSource</varname> is <constant>TRUE</constant>
  90. (<constant>FALSE</constant> by default), the data is treated as beeing
  91. present in a <acronym>LDAP</acronym> tree.
  92. </entry>
  93. </row>
  94. <row>
  95. <entry><code>boolean isNew()</code></entry>
  96. <entry>
  97. Tells if the node is consiedered as new (not present on the
  98. server). Please note, that this doesn't tell if the node is really
  99. present on the server. Use <methodname>Zend_Ldap_Node::exists()</methodname>
  100. to see if a node is already there.
  101. </entry>
  102. </row>
  103. <row>
  104. <entry><code>boolean willBeDeleted()</code></entry>
  105. <entry>
  106. Tells if this node is going to be deleted once
  107. <methodname>Zend_Ldap_Node::update()</methodname> is called.
  108. </entry>
  109. </row>
  110. <row>
  111. <entry><code>Zend_Ldap_Node delete()</code></entry>
  112. <entry>
  113. Marks this node as to be deleted. Node will be deleted on
  114. calling <methodname>Zend_Ldap_Node::update()</methodname> if
  115. <methodname>Zend_Ldap_Node::willBeDeleted()</methodname> is
  116. <constant>TRUE</constant>.
  117. </entry>
  118. </row>
  119. <row>
  120. <entry><code>boolean willBeMoved()</code></entry>
  121. <entry>
  122. Tells if this node is going to be moved once
  123. <methodname>Zend_Ldap_Node::update()</methodname> is called.
  124. </entry>
  125. </row>
  126. <row>
  127. <entry><code>Zend_Ldap_Node update(Zend_Ldap $ldap)</code></entry>
  128. <entry>
  129. Sends all pending changes to the <acronym>LDAP</acronym> server. If
  130. <varname>$ldap</varname> is omitted the current <acronym>LDAP</acronym>
  131. connection is used. If the current node is detached from a
  132. <acronym>LDAP</acronym> connection a
  133. <classname>Zend_Ldap_Exception</classname> will be thrown. If
  134. <varname>$ldap</varname> is provided the current node will be attached to
  135. the given <acronym>LDAP</acronym> connection.
  136. </entry>
  137. </row>
  138. <row>
  139. <entry><code>Zend_Ldap_Dn getCurrentDn()</code></entry>
  140. <entry>
  141. Gets the current DN of the current node as a Zend_Ldap_Dn.
  142. This does not reflect possible rename-operations.
  143. </entry>
  144. </row>
  145. <row>
  146. <entry><code>Zend_Ldap_Dn getDn()</code></entry>
  147. <entry>
  148. Gets the original DN of the current node as a Zend_Ldap_Dn.
  149. This reflects possible rename-operations.
  150. </entry>
  151. </row>
  152. <row>
  153. <entry><code>string getDnString(string $caseFold)</code></entry>
  154. <entry>
  155. Gets the original DN of the current node as a string. This
  156. reflects possible rename-operations.
  157. </entry>
  158. </row>
  159. <row>
  160. <entry><code>array getDnArray(string $caseFold)</code></entry>
  161. <entry>
  162. Gets the original DN of the current node as an array. This
  163. reflects possible rename-operations.
  164. </entry>
  165. </row>
  166. <row>
  167. <entry><code>string getRdnString(string $caseFold)</code></entry>
  168. <entry>
  169. Gets the <acronym>RDN</acronym> of the current node as a string. This
  170. reflects possible rename-operations.
  171. </entry>
  172. </row>
  173. <row>
  174. <entry><code>array getRdnArray(string $caseFold)</code></entry>
  175. <entry>
  176. Gets the <acronym>RDN</acronym> of the current node as an array. This
  177. reflects possible rename-operations.
  178. </entry>
  179. </row>
  180. <row>
  181. <entry>
  182. <code>Zend_Ldap_Node setDn(Zend_Ldap_Dn|string|array $newDn)</code>
  183. </entry>
  184. <entry>
  185. Sets the new DN for this node effectively moving the node
  186. once <methodname>Zend_Ldap_Node::update()</methodname> is called.
  187. </entry>
  188. </row>
  189. <row>
  190. <entry>
  191. <code>Zend_Ldap_Node move(Zend_Ldap_Dn|string|array $newDn)</code>
  192. </entry>
  193. <entry>
  194. This is an alias for <methodname>Zend_Ldap_Node::setDn()</methodname>.
  195. </entry>
  196. </row>
  197. <row>
  198. <entry>
  199. <code>Zend_Ldap_Node rename(Zend_Ldap_Dn|string|array $newDn)</code>
  200. </entry>
  201. <entry>
  202. This is an alias for <methodname>Zend_Ldap_Node::setDn()</methodname>.
  203. </entry>
  204. </row>
  205. <row>
  206. <entry><code>array getObjectClass()</code></entry>
  207. <entry>Returns the objectClass of the node.</entry>
  208. </row>
  209. <row>
  210. <entry><code>Zend_Ldap_Node setObjectClass(array|string $value)</code></entry>
  211. <entry>Sets the objectClass attribute.</entry>
  212. </row>
  213. <row>
  214. <entry>
  215. <code>Zend_Ldap_Node appendObjectClass(array|string $value)</code>
  216. </entry>
  217. <entry>Appends to the objectClass attribute.</entry>
  218. </row>
  219. <row>
  220. <entry><code>string toLdif(array $options)</code></entry>
  221. <entry>
  222. Returns a <acronym>LDIF</acronym> representation of the current node.
  223. <varname>$options</varname> will be passed to the
  224. <classname>Zend_Ldap_Ldif_Encoder</classname>.
  225. </entry>
  226. </row>
  227. <row>
  228. <entry><code>array getChangedData()</code></entry>
  229. <entry>
  230. Gets changed node data. The array contains all changed
  231. attributes. This format can be used in
  232. <methodname>Zend_Ldap::add()</methodname> and
  233. <methodname>Zend_Ldap::update()</methodname>.
  234. </entry>
  235. </row>
  236. <row>
  237. <entry><code>array getChanges()</code></entry>
  238. <entry>Returns all changes made.</entry>
  239. </row>
  240. <row>
  241. <entry><code>string toString()</code></entry>
  242. <entry>
  243. Returns the DN of the current node - proxies to
  244. <methodname>Zend_Ldap_Dn::getDnString()</methodname>.
  245. </entry>
  246. </row>
  247. <row>
  248. <entry><code>string __toString()</code></entry>
  249. <entry>
  250. Casts to string representation - proxies to
  251. <methodname>Zend_Ldap_Dn::toString()</methodname>.
  252. </entry>
  253. </row>
  254. <row>
  255. <entry><code>array toArray(boolean $includeSystemAttributes)</code></entry>
  256. <entry>
  257. Returns an array representation of the current node. If
  258. <varname>$includeSystemAttributes</varname> is <constant>FALSE</constant>
  259. (defaults to <constant>TRUE</constant>) the system specific attributes are
  260. stripped from the array. Unlike
  261. <methodname>Zend_Ldap_Node::getAttributes()</methodname> the resulting array
  262. contains the DN with key <code>'dn'</code>.
  263. </entry>
  264. </row>
  265. <row>
  266. <entry><code>string toJson(boolean $includeSystemAttributes)</code></entry>
  267. <entry>
  268. Returns a <acronym>JSON</acronym> representation of the current node using
  269. <methodname>Zend_Ldap_Node::toArray()</methodname>.
  270. </entry>
  271. </row>
  272. <row>
  273. <entry><code>array getData(boolean $includeSystemAttributes)</code></entry>
  274. <entry>
  275. Returns the node's attributes. The array contains all
  276. attributes in its internal format (no conversion).
  277. </entry>
  278. </row>
  279. <row>
  280. <entry>
  281. <code>boolean existsAttribute(string $name, boolean $emptyExists)</code>
  282. </entry>
  283. <entry>
  284. Checks whether a given attribute exists. If
  285. <varname>$emptyExists</varname> is <constant>FALSE</constant> empty
  286. attributes (containing only array()) are treated as non-existent returning
  287. <constant>FALSE</constant>. If <varname>$emptyExists</varname> is
  288. <constant>TRUE</constant> empty attributes are treated as existent returning
  289. <constant>TRUE</constant>. In this case the method returns
  290. <constant>FALSE</constant> only if the attribute name is missing in the
  291. key-collection.
  292. </entry>
  293. </row>
  294. <row>
  295. <entry>
  296. <code>boolean attributeHasValue(string $name, mixed|array $value)</code>
  297. </entry>
  298. <entry>
  299. Checks if the given value(s) exist in the attribute. The
  300. method returns <constant>TRUE</constant> only if all values in
  301. <varname>$value</varname> are present in the attribute. Comparison is
  302. done strictly (respecting the data type).
  303. </entry>
  304. </row>
  305. <row>
  306. <entry><code>integer count()</code></entry>
  307. <entry>
  308. Returns the number of attributes in the node. Implements Countable.
  309. </entry>
  310. </row>
  311. <row>
  312. <entry>
  313. <code>mixed getAttribute(string $name, integer|null $index)</code>
  314. </entry>
  315. <entry>
  316. Gets a <acronym>LDAP</acronym> attribute. Data conversion is applied using
  317. <methodname>Zend_Ldap_Attribute::getAttribute()</methodname>.
  318. </entry>
  319. </row>
  320. <row>
  321. <entry>
  322. <code>array getAttributes(boolean $includeSystemAttributes)</code>
  323. </entry>
  324. <entry>
  325. Gets all attributes of node. If
  326. <varname>$includeSystemAttributes</varname> is <constant>FALSE</constant>
  327. (defaults to <constant>TRUE</constant>) the system specific attributes are
  328. stripped from the array.
  329. </entry>
  330. </row>
  331. <row>
  332. <entry>
  333. <code>Zend_Ldap_Node setAttribute(string $name, mixed $value)</code>
  334. </entry>
  335. <entry>
  336. Sets a <acronym>LDAP</acronym> attribute. Data conversion is applied using
  337. <methodname>Zend_Ldap_Attribute::setAttribute()</methodname>.
  338. </entry>
  339. </row>
  340. <row>
  341. <entry>
  342. <code>Zend_Ldap_Node appendToAttribute(string $name, mixed $value)</code>
  343. </entry>
  344. <entry>
  345. Appends to a <acronym>LDAP</acronym> attribute. Data conversion is applied
  346. using <methodname>Zend_Ldap_Attribute::setAttribute()</methodname>.
  347. </entry>
  348. </row>
  349. <row>
  350. <entry>
  351. <code>array|integer getDateTimeAttribute(string $name,
  352. integer|null $index)</code>
  353. </entry>
  354. <entry>
  355. Gets a <acronym>LDAP</acronym> date/time attribute. Data conversion is
  356. applied using
  357. <methodname>Zend_Ldap_Attribute::getDateTimeAttribute()</methodname>.
  358. </entry>
  359. </row>
  360. <row>
  361. <entry>
  362. <code>Zend_Ldap_Node setDateTimeAttribute(string $name,
  363. integer|array $value, boolean $utc)</code>
  364. </entry>
  365. <entry>
  366. Sets a <acronym>LDAP</acronym> date/time attribute. Data conversion is
  367. applied using
  368. <methodname>Zend_Ldap_Attribute::setDateTimeAttribute()</methodname>.
  369. </entry>
  370. </row>
  371. <row>
  372. <entry>
  373. <code>Zend_Ldap_Node appendToDateTimeAttribute(string $name,
  374. integer|array $value, boolean $utc)</code>
  375. </entry>
  376. <entry>
  377. Appends to a <acronym>LDAP</acronym> date/time attribute. Data conversion is
  378. applied using
  379. <methodname>Zend_Ldap_Attribute::setDateTimeAttribute()</methodname>.
  380. </entry>
  381. </row>
  382. <row>
  383. <entry>
  384. <code>Zend_Ldap_Node setPasswordAttribute(string $password,
  385. string $hashType, string $attribName)</code>
  386. </entry>
  387. <entry>
  388. Sets a <acronym>LDAP</acronym> password on <varname>$attribName</varname>
  389. (defaults to <code>'userPassword'</code>) to <varname>$password</varname>
  390. with the hash type <varname>$hashType</varname> (defaults to
  391. <constant>Zend_Ldap_Attribute::PASSWORD_HASH_MD5</constant>).
  392. </entry>
  393. </row>
  394. <row>
  395. <entry><code>Zend_Ldap_Node deleteAttribute(string $name)</code></entry>
  396. <entry>Deletes a <acronym>LDAP</acronym> attribute.</entry>
  397. </row>
  398. <row>
  399. <entry><code>void removeDuplicatesFromAttribute(string$name)</code></entry>
  400. <entry>
  401. Removes duplicate values from a <acronym>LDAP</acronym> attribute.
  402. </entry>
  403. </row>
  404. <row>
  405. <entry>
  406. <code>void removeFromAttribute(string $attribName,
  407. mixed|array $value)</code>
  408. </entry>
  409. <entry>
  410. Removes the given values from a <acronym>LDAP</acronym> attribute.
  411. </entry>
  412. </row>
  413. <row>
  414. <entry><code>boolean exists(Zend_Ldap $ldap)</code></entry>
  415. <entry>
  416. Checks if the current node exists on the given <acronym>LDAP</acronym>
  417. server (current server is used if <constant>NULL</constant> is passed).
  418. </entry>
  419. </row>
  420. <row>
  421. <entry><code>Zend_Ldap_Node reload(Zend_Ldap $ldap)</code></entry>
  422. <entry>
  423. Reloads the current node's attributes from the given <acronym>LDAP</acronym>
  424. server (current server is used if <constant>NULL</constant> is
  425. passed).
  426. </entry>
  427. </row>
  428. <row>
  429. <entry>
  430. <code>Zend_Ldap_Node_Collection
  431. searchSubtree(string|Zend_Ldap_Filter_Abstract $filter, integer
  432. $scope, string $sort)</code>
  433. </entry>
  434. <entry>
  435. Searches the nodes's subtree with the given
  436. <varname>$filter</varname> and the given search parameters. See
  437. <methodname>Zend_Ldap::search()</methodname> for details on the parameters
  438. <varname>$scope</varname> and <varname>$sort</varname>.
  439. </entry>
  440. </row>
  441. <row>
  442. <entry>
  443. <code>integer countSubtree(string|Zend_Ldap_Filter_Abstract
  444. $filter, integer $scope)</code>
  445. </entry>
  446. <entry>
  447. Count the nodes's subtree items matching the given
  448. <varname>$filter</varname> and the given search scope. See
  449. <methodname>Zend_Ldap::search()</methodname> for details on the
  450. <varname>$scope</varname> parameter.
  451. </entry>
  452. </row>
  453. <row>
  454. <entry><code>integer countChildren()</code></entry>
  455. <entry>Count the nodes's children.</entry>
  456. </row>
  457. <row>
  458. <entry>
  459. <code>Zend_Ldap_Node_Collection
  460. searchChildren(string|Zend_Ldap_Filter_Abstract $filter, string
  461. $sort)</code>
  462. </entry>
  463. <entry>
  464. Searches the nodes's children matching the given
  465. <varname>$filter</varname>. See <methodname>Zend_Ldap::search()</methodname>
  466. for details on the <varname>$sort</varname> parameter.
  467. </entry>
  468. </row>
  469. <row>
  470. <entry><code>boolean hasChildren()</code></entry>
  471. <entry>Returns whether the current node has children.</entry>
  472. </row>
  473. <row>
  474. <entry><code>Zend_Ldap_Node_ChildrenIterator getChildren()</code></entry>
  475. <entry>Returns all children of the current node.</entry>
  476. </row>
  477. <row>
  478. <entry><code>Zend_Ldap_Node getParent(Zend_Ldap $ldap)</code></entry>
  479. <entry>
  480. Returns the parent of the current node using the <acronym>LDAP</acronym>
  481. connection <varname>$ldap</varname> (uses the current
  482. <acronym>LDAP</acronym> connection if omitted).
  483. </entry>
  484. </row>
  485. </tbody>
  486. </tgroup>
  487. </table>
  488. </sect3>