Zend_Ldap-API-Ldap-Node.xml 24 KB

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