Zend_Ldap-API-Ldap-Node.xml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528
  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>, <methodname>__unset()</methodname> and
  8. <methodname>__isset()</methodname> to access the attributes by their name. They proxy to
  9. <methodname>Zend_Ldap_Node::setAttribute()</methodname>,
  10. <methodname>Zend_Ldap_Node::getAttribute()</methodname>,
  11. <methodname>Zend_Ldap_Node::deleteAttribute()</methodname> and
  12. <methodname>Zend_Ldap_Node::existsAttribute()</methodname> respectively. Furthermore the class
  13. implements <code>ArrayAccess</code> for array-style-access to the attributes.
  14. <classname>Zend_Ldap_Node</classname> also implements <code>Iterator</code> and
  15. <code>RecursiveIterato</code> to allow for recursive tree-traversal.
  16. </para>
  17. <table id="zend.ldap.api.reference.zend-ldap-node.table">
  18. <title>Zend_Ldap_Node API</title>
  19. <tgroup cols="2">
  20. <thead>
  21. <row>
  22. <entry>Method</entry>
  23. <entry>Description</entry>
  24. </row>
  25. </thead>
  26. <tbody>
  27. <row>
  28. <entry><code>Zend_Ldap getLdap()</code></entry>
  29. <entry>
  30. Returns the current <acronym>LDAP</acronym> connection. Throws
  31. <classname>Zend_Ldap_Exception</classname> if current node is in detached
  32. mode (not connected to a <classname>Zend_Ldap</classname> instance).
  33. </entry>
  34. </row>
  35. <row>
  36. <entry>
  37. <code>Zend_Ldap_Node attachLdap(Zend_Ldap
  38. $ldap)</code>
  39. </entry>
  40. <entry>
  41. Attach the current node to the <varname>$ldap</varname>
  42. <classname>Zend_Ldap</classname> instance. Throws
  43. <classname>Zend_Ldap_Exception</classname> if <varname>$ldap</varname> is not
  44. responsible for the current node (node is not a child of the
  45. <varname>$ldap</varname> base DN).
  46. </entry>
  47. </row>
  48. <row>
  49. <entry><code>Zend_Ldap_Node detachLdap()</code></entry>
  50. <entry>Detach node from <acronym>LDAP</acronym> connection.</entry>
  51. </row>
  52. <row>
  53. <entry><code>boolean isAttached()</code></entry>
  54. <entry>
  55. Checks if the current node is attached to a <acronym>LDAP</acronym>
  56. connection.
  57. </entry>
  58. </row>
  59. <row>
  60. <entry>
  61. <emphasis><code>Zend_Ldap_Node
  62. create(string|array|Zend_Ldap_Dn $dn, array $objectClass)</code>
  63. </emphasis>
  64. </entry>
  65. <entry>
  66. Factory method to create a new detached
  67. <classname>Zend_Ldap_Node</classname> for a given DN. Creates a new
  68. <classname>Zend_Ldap_Node</classname> with the DN <varname>$dn</varname> and the
  69. object-classes <varname>$objectClass</varname>.
  70. </entry>
  71. </row>
  72. <row>
  73. <entry>
  74. <emphasis><code>Zend_Ldap_Node
  75. fromLdap(string|array|Zend_Ldap_Dn $dn, Zend_Ldap $ldap)</code>
  76. </emphasis>
  77. </entry>
  78. <entry>
  79. Factory method to create an attached
  80. <classname>Zend_Ldap_Node</classname> for a given DN. Loads an existing
  81. <classname>Zend_Ldap_Node</classname> with the DN <varname>$dn</varname> from the
  82. <acronym>LDAP</acronym> connection <varname>$ldap</varname>.
  83. </entry>
  84. </row>
  85. <row>
  86. <entry>
  87. <emphasis><code>Zend_Ldap_Node fromArray((array $data,
  88. boolean $fromDataSource)</code> </emphasis>
  89. </entry>
  90. <entry>
  91. Factory method to create a detached
  92. <classname>Zend_Ldap_Node</classname> from array data <varname>$data</varname>. If
  93. <varname>$fromDataSource</varname> is <constant>TRUE</constant>
  94. (<constant>FALSE</constant> by default), the data is treated as beeing
  95. present in a <acronym>LDAP</acronym> tree.
  96. </entry>
  97. </row>
  98. <row>
  99. <entry><code>boolean isNew()</code></entry>
  100. <entry>
  101. Tells if the node is consiedered as new (not present on the
  102. server). Please note, that this doesn't tell if the node is really
  103. present on the server. Use <methodname>Zend_Ldap_Node::exists()</methodname> to
  104. see if a node is already there.
  105. </entry>
  106. </row>
  107. <row>
  108. <entry><code>boolean willBeDeleted()</code></entry>
  109. <entry>
  110. Tells if this node is going to be deleted once
  111. <methodname>Zend_Ldap_Node::update()</methodname> is called.
  112. </entry>
  113. </row>
  114. <row>
  115. <entry><code>Zend_Ldap_Node delete()</code></entry>
  116. <entry>
  117. Marks this node as to be deleted. Node will be deleted on
  118. calling <methodname>Zend_Ldap_Node::update()</methodname> if
  119. <methodname>Zend_Ldap_Node::willBeDeleted()</methodname> is
  120. <constant>TRUE</constant>.
  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. <methodname>Zend_Ldap_Node::update()</methodname> 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. <varname>$ldap</varname> 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. <classname>Zend_Ldap_Exception</classname> will be thrown. If
  137. <varname>$ldap</varname> 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 <methodname>Zend_Ldap_Node::update()</methodname> 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. <methodname>Zend_Ldap_Node::setDn()</methodname>.
  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. <methodname>Zend_Ldap_Node::setDn()</methodname>.
  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. <varname>$options</varname> will be passed to the
  236. <classname>Zend_Ldap_Ldif_Encoder</classname>.
  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. <methodname>Zend_Ldap::add()</methodname> and
  245. <methodname>Zend_Ldap::update()</methodname>.
  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. <methodname>Zend_Ldap_Dn::getDnString()</methodname>.
  257. </entry>
  258. </row>
  259. <row>
  260. <entry><code>string __toString()</code></entry>
  261. <entry>
  262. Casts to string representation - proxies to
  263. <methodname>Zend_Ldap_Dn::toString()</methodname>.
  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. <varname>$includeSystemAttributes</varname> is <constant>FALSE</constant>
  274. (defaults to <constant>TRUE</constant>) the system specific attributes are
  275. stripped from the array. Unlike
  276. <methodname>Zend_Ldap_Node::getAttributes()</methodname> 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. <methodname>Zend_Ldap_Node::toArray()</methodname>.
  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. <varname>$emptyExists</varname> is <constant>FALSE</constant> empty
  308. attributes (containing only array()) are treated as non-existent returning
  309. <constant>FALSE</constant>. If <varname>$emptyExists</varname> is
  310. <constant>TRUE</constant> empty attributes are treated as existent returning
  311. <constant>TRUE</constant>. In this case the method returns
  312. <constant>FALSE</constant> only if the attribute name is missing in the
  313. key-collection.
  314. </entry>
  315. </row>
  316. <row>
  317. <entry>
  318. <code>boolean attributeHasValue(string $name, mixed|array
  319. $value)</code>
  320. </entry>
  321. <entry>
  322. Checks if the given value(s) exist in the attribute. The
  323. method returns <constant>TRUE</constant> only if all values in
  324. <varname>$value</varname> are present in the attribute. Comparison is
  325. done strictly (respecting the data type).
  326. </entry>
  327. </row>
  328. <row>
  329. <entry><code>integer count()</code></entry>
  330. <entry>
  331. Returns the number of attributes in the node. Implements
  332. Countable.
  333. </entry>
  334. </row>
  335. <row>
  336. <entry>
  337. <code>mixed getAttribute(string $name, integer|null
  338. $index)</code>
  339. </entry>
  340. <entry>
  341. Gets a <acronym>LDAP</acronym> attribute. Data conversion is applied using
  342. <methodname>Zend_Ldap_Attribute::getAttribute()</methodname>.
  343. </entry>
  344. </row>
  345. <row>
  346. <entry>
  347. <code>array getAttributes(boolean
  348. $includeSystemAttributes)</code>
  349. </entry>
  350. <entry>
  351. Gets all attributes of node. If
  352. <varname>$includeSystemAttributes</varname> is <constant>FALSE</constant>
  353. (defaults to <constant>TRUE</constant>) the system specific attributes are
  354. stripped from the array.
  355. </entry>
  356. </row>
  357. <row>
  358. <entry>
  359. <code>Zend_Ldap_Node setAttribute(string $name, mixed
  360. $value)</code>
  361. </entry>
  362. <entry>
  363. Sets a <acronym>LDAP</acronym> attribute. Data conversion is applied using
  364. <methodname>Zend_Ldap_Attribute::setAttribute()</methodname>.
  365. </entry>
  366. </row>
  367. <row>
  368. <entry>
  369. <code>Zend_Ldap_Node appendToAttribute(string $name, mixed
  370. $value)</code>
  371. </entry>
  372. <entry>
  373. Appends to a <acronym>LDAP</acronym> attribute. Data conversion is applied
  374. using <methodname>Zend_Ldap_Attribute::setAttribute()</methodname>.
  375. </entry>
  376. </row>
  377. <row>
  378. <entry>
  379. <code>array|integer getDateTimeAttribute(string $name,
  380. integer|null $index)</code>
  381. </entry>
  382. <entry>
  383. Gets a <acronym>LDAP</acronym> date/time attribute. Data conversion is applied
  384. using
  385. <methodname>Zend_Ldap_Attribute::getDateTimeAttribute()</methodname>.
  386. </entry>
  387. </row>
  388. <row>
  389. <entry>
  390. <code>Zend_Ldap_Node setDateTimeAttribute(string $name,
  391. integer|array $value, boolean $utc)</code>
  392. </entry>
  393. <entry>
  394. Sets a <acronym>LDAP</acronym> date/time attribute. Data conversion is applied
  395. using
  396. <methodname>Zend_Ldap_Attribute::setDateTimeAttribute()</methodname>.
  397. </entry>
  398. </row>
  399. <row>
  400. <entry>
  401. <code>Zend_Ldap_Node appendToDateTimeAttribute(string $name,
  402. integer|array $value, boolean $utc)</code>
  403. </entry>
  404. <entry>
  405. Appends to a <acronym>LDAP</acronym> date/time attribute. Data conversion is
  406. applied using
  407. <methodname>Zend_Ldap_Attribute::setDateTimeAttribute()</methodname>.
  408. </entry>
  409. </row>
  410. <row>
  411. <entry>
  412. <code>Zend_Ldap_Node setPasswordAttribute(string $password,
  413. string $hashType, string $attribName)</code>
  414. </entry>
  415. <entry>
  416. Sets a <acronym>LDAP</acronym> password on <varname>$attribName</varname> (defaults
  417. to <code>'userPassword'</code>) to <varname>$password</varname> with the
  418. hash type <varname>$hashType</varname> (defaults to
  419. <constant>Zend_Ldap_Attribute::PASSWORD_HASH_MD5</constant>).
  420. </entry>
  421. </row>
  422. <row>
  423. <entry>
  424. <code>Zend_Ldap_Node deleteAttribute(string
  425. $name)</code>
  426. </entry>
  427. <entry>Deletes a <acronym>LDAP</acronym> attribute.</entry>
  428. </row>
  429. <row>
  430. <entry>
  431. <code>void removeDuplicatesFromAttribute(string
  432. $name)</code>
  433. </entry>
  434. <entry>Removes duplicate values from a <acronym>LDAP</acronym> attribute.</entry>
  435. </row>
  436. <row>
  437. <entry>
  438. <code>void removeFromAttribute(string $attribName,
  439. mixed|array $value)</code>
  440. </entry>
  441. <entry>Removes the given values from a <acronym>LDAP</acronym> attribute.</entry>
  442. </row>
  443. <row>
  444. <entry><code>boolean exists(Zend_Ldap $ldap)</code></entry>
  445. <entry>
  446. Checks if the current node exists on the given <acronym>LDAP</acronym> server
  447. (current server is used if <constant>NULL</constant> is passed).
  448. </entry>
  449. </row>
  450. <row>
  451. <entry><code>Zend_Ldap_Node reload(Zend_Ldap $ldap)</code></entry>
  452. <entry>
  453. Reloads the current node's attributes from the given <acronym>LDAP</acronym>
  454. server (current server is used if <constant>NULL</constant> is
  455. passed).
  456. </entry>
  457. </row>
  458. <row>
  459. <entry>
  460. <code>Zend_Ldap_Node_Collection
  461. searchSubtree(string|Zend_Ldap_Filter_Abstract $filter, integer
  462. $scope, string $sort)</code>
  463. </entry>
  464. <entry>
  465. Searches the nodes's subtree with the given
  466. <varname>$filter</varname> and the given search parameters. See
  467. <methodname>Zend_Ldap::search()</methodname> for details on the parameters
  468. <varname>$scope</varname> and <varname>$sort</varname>.
  469. </entry>
  470. </row>
  471. <row>
  472. <entry>
  473. <code>integer countSubtree(string|Zend_Ldap_Filter_Abstract
  474. $filter, integer $scope)</code>
  475. </entry>
  476. <entry>
  477. Count the nodes's subtree items matching the given
  478. <varname>$filter</varname> and the given search scope. See
  479. <methodname>Zend_Ldap::search()</methodname> for details on the
  480. <varname>$scope</varname> parameter.
  481. </entry>
  482. </row>
  483. <row>
  484. <entry><code>integer countChildren()</code></entry>
  485. <entry>Count the nodes's children.</entry>
  486. </row>
  487. <row>
  488. <entry>
  489. <code>Zend_Ldap_Node_Collection
  490. searchChildren(string|Zend_Ldap_Filter_Abstract $filter, string
  491. $sort)</code>
  492. </entry>
  493. <entry>
  494. Searches the nodes's children matching the given
  495. <varname>$filter</varname>. See <methodname>Zend_Ldap::search()</methodname> for
  496. details on the <varname>$sort</varname> parameter.
  497. </entry>
  498. </row>
  499. <row>
  500. <entry><code>boolean hasChildren()</code></entry>
  501. <entry>Returns whether the current node has children.</entry>
  502. </row>
  503. <row>
  504. <entry>
  505. <code>Zend_Ldap_Node_ChildrenIterator
  506. getChildren()</code>
  507. </entry>
  508. <entry>Returns all children of the current node.</entry>
  509. </row>
  510. <row>
  511. <entry>
  512. <code>Zend_Ldap_Node getParent(Zend_Ldap
  513. $ldap)</code>
  514. </entry>
  515. <entry>
  516. Returns the parent of the current node using the <acronym>LDAP</acronym>
  517. connection <varname>$ldap</varname> (uses the current <acronym>LDAP</acronym> connection if
  518. omitted).
  519. </entry>
  520. </row>
  521. </tbody>
  522. </tgroup>
  523. </table>
  524. </sect3>