Zend_Ldap-API-Ldap-Node.xml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  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 true.
  120. </entry>
  121. </row>
  122. <row>
  123. <entry><code>boolean willBeMoved()</code></entry>
  124. <entry>
  125. Tells if this node is going to be moved once
  126. <methodname>Zend_Ldap_Node::update()</methodname> is called.
  127. </entry>
  128. </row>
  129. <row>
  130. <entry><code>Zend_Ldap_Node update(Zend_Ldap $ldap)</code></entry>
  131. <entry>
  132. Sends all pending changes to the <acronym>LDAP</acronym> server. If
  133. <varname>$ldap</varname> is omitted the current <acronym>LDAP</acronym> connection is used.
  134. If the current node is detached from a <acronym>LDAP</acronym> connection a
  135. <classname>Zend_Ldap_Exception</classname> will be thrown. If
  136. <varname>$ldap</varname> is provided the current node will be attached to
  137. the given <acronym>LDAP</acronym> connection.
  138. </entry>
  139. </row>
  140. <row>
  141. <entry><code>Zend_Ldap_Dn getCurrentDn()</code></entry>
  142. <entry>
  143. Gets the current DN of the current node as a Zend_Ldap_Dn.
  144. This does not reflect possible rename-operations.
  145. </entry>
  146. </row>
  147. <row>
  148. <entry><code>Zend_Ldap_Dn getDn()</code></entry>
  149. <entry>
  150. Gets the original DN of the current node as a Zend_Ldap_Dn.
  151. This reflects possible rename-operations.
  152. </entry>
  153. </row>
  154. <row>
  155. <entry><code>string getDnString(string $caseFold)</code></entry>
  156. <entry>
  157. Gets the original DN of the current node as a string. This
  158. reflects possible rename-operations.
  159. </entry>
  160. </row>
  161. <row>
  162. <entry><code>array getDnArray(string $caseFold)</code></entry>
  163. <entry>
  164. Gets the original DN of the current node as an array. This
  165. reflects possible rename-operations.
  166. </entry>
  167. </row>
  168. <row>
  169. <entry><code>string getRdnString(string $caseFold)</code></entry>
  170. <entry>
  171. Gets the <acronym>RDN</acronym> of the current node as a string. This reflects
  172. possible rename-operations.
  173. </entry>
  174. </row>
  175. <row>
  176. <entry><code>array getRdnArray(string $caseFold)</code></entry>
  177. <entry>
  178. Gets the <acronym>RDN</acronym> of the current node as an array. This reflects
  179. possible rename-operations.
  180. </entry>
  181. </row>
  182. <row>
  183. <entry>
  184. <code>Zend_Ldap_Node setDn(Zend_Ldap_Dn|string|array
  185. $newDn)</code>
  186. </entry>
  187. <entry>
  188. Sets the new DN for this node effectively moving the node
  189. once <methodname>Zend_Ldap_Node::update()</methodname> is called.
  190. </entry>
  191. </row>
  192. <row>
  193. <entry>
  194. <code>Zend_Ldap_Node move(Zend_Ldap_Dn|string|array
  195. $newDn)</code>
  196. </entry>
  197. <entry>
  198. This is an alias for
  199. <methodname>Zend_Ldap_Node::setDn()</methodname>.
  200. </entry>
  201. </row>
  202. <row>
  203. <entry>
  204. <code>Zend_Ldap_Node rename(Zend_Ldap_Dn|string|array
  205. $newDn)</code>
  206. </entry>
  207. <entry>
  208. This is an alias for
  209. <methodname>Zend_Ldap_Node::setDn()</methodname>.
  210. </entry>
  211. </row>
  212. <row>
  213. <entry><code>array getObjectClass()</code></entry>
  214. <entry>Returns the objectClass of the node.</entry>
  215. </row>
  216. <row>
  217. <entry>
  218. <code>Zend_Ldap_Node setObjectClass(array|string
  219. $value)</code>
  220. </entry>
  221. <entry>Sets the objectClass attribute.</entry>
  222. </row>
  223. <row>
  224. <entry>
  225. <code>Zend_Ldap_Node appendObjectClass(array|string
  226. $value)</code>
  227. </entry>
  228. <entry>Appends to the objectClass attribute.</entry>
  229. </row>
  230. <row>
  231. <entry><code>string toLdif(array $options)</code></entry>
  232. <entry>
  233. Returns a <acronym>LDIF</acronym> representation of the current node.
  234. <varname>$options</varname> will be passed to the
  235. <classname>Zend_Ldap_Ldif_Encoder</classname>.
  236. </entry>
  237. </row>
  238. <row>
  239. <entry><code>array getChangedData()</code></entry>
  240. <entry>
  241. Gets changed node data. The array contains all changed
  242. attributes. This format can be used in
  243. <methodname>Zend_Ldap::add()</methodname> and
  244. <methodname>Zend_Ldap::update()</methodname>.
  245. </entry>
  246. </row>
  247. <row>
  248. <entry><code>array getChanges()</code></entry>
  249. <entry>Returns all changes made.</entry>
  250. </row>
  251. <row>
  252. <entry><code>string toString()</code></entry>
  253. <entry>
  254. Returns the DN of the current node - proxies to
  255. <methodname>Zend_Ldap_Dn::getDnString()</methodname>.
  256. </entry>
  257. </row>
  258. <row>
  259. <entry><code>string __toString()</code></entry>
  260. <entry>
  261. Casts to string representation - proxies to
  262. <methodname>Zend_Ldap_Dn::toString()</methodname>.
  263. </entry>
  264. </row>
  265. <row>
  266. <entry>
  267. <code>array toArray(boolean
  268. $includeSystemAttributes)</code>
  269. </entry>
  270. <entry>
  271. Returns an array representation of the current node. If
  272. <varname>$includeSystemAttributes</varname> is <constant>FALSE</constant>
  273. (defaults to <constant>TRUE</constant>) the system specific attributes are
  274. stripped from the array. Unlike
  275. <methodname>Zend_Ldap_Node::getAttributes()</methodname> the resulting array
  276. contains the DN with key <code>'dn'</code>.
  277. </entry>
  278. </row>
  279. <row>
  280. <entry>
  281. <code>string toJson(boolean
  282. $includeSystemAttributes)</code>
  283. </entry>
  284. <entry>
  285. Returns a <acronym>JSON</acronym> representation of the current node using
  286. <methodname>Zend_Ldap_Node::toArray()</methodname>.
  287. </entry>
  288. </row>
  289. <row>
  290. <entry>
  291. <code>array getData(boolean
  292. $includeSystemAttributes)</code>
  293. </entry>
  294. <entry>
  295. Returns the node's attributes. The array contains all
  296. attributes in its internal format (no conversion).
  297. </entry>
  298. </row>
  299. <row>
  300. <entry>
  301. <code>boolean existsAttribute(string $name, boolean
  302. $emptyExists)</code>
  303. </entry>
  304. <entry>
  305. Checks whether a given attribute exists. If
  306. <varname>$emptyExists</varname> is <constant>FALSE</constant> empty attributes
  307. (containing only array()) are treated as non-existent returning
  308. <constant>FALSE</constant>. If <varname>$emptyExists</varname> is true empty
  309. attributes are treated as existent returning <constant>TRUE</constant>. In
  310. this case the method returns <constant>FALSE</constant> only if the
  311. attribute name is missing in the key-collection.
  312. </entry>
  313. </row>
  314. <row>
  315. <entry>
  316. <code>boolean attributeHasValue(string $name, mixed|array
  317. $value)</code>
  318. </entry>
  319. <entry>
  320. Checks if the given value(s) exist in the attribute. The
  321. method returns <constant>TRUE</constant> only if all values in
  322. <varname>$value</varname> are present in the attribute. Comparison is
  323. done strictly (respecting the data type).
  324. </entry>
  325. </row>
  326. <row>
  327. <entry><code>integer count()</code></entry>
  328. <entry>
  329. Returns the number of attributes in the node. Implements
  330. Countable.
  331. </entry>
  332. </row>
  333. <row>
  334. <entry>
  335. <code>mixed getAttribute(string $name, integer|null
  336. $index)</code>
  337. </entry>
  338. <entry>
  339. Gets a <acronym>LDAP</acronym> attribute. Data conversion is applied using
  340. <methodname>Zend_Ldap_Attribute::getAttribute()</methodname>.
  341. </entry>
  342. </row>
  343. <row>
  344. <entry>
  345. <code>array getAttributes(boolean
  346. $includeSystemAttributes)</code>
  347. </entry>
  348. <entry>
  349. Gets all attributes of node. If
  350. <varname>$includeSystemAttributes</varname> is <constant>FALSE</constant>
  351. (defaults to <constant>TRUE</constant>) the system specific attributes are
  352. stripped from the array.
  353. </entry>
  354. </row>
  355. <row>
  356. <entry>
  357. <code>Zend_Ldap_Node setAttribute(string $name, mixed
  358. $value)</code>
  359. </entry>
  360. <entry>
  361. Sets a <acronym>LDAP</acronym> attribute. Data conversion is applied using
  362. <methodname>Zend_Ldap_Attribute::setAttribute()</methodname>.
  363. </entry>
  364. </row>
  365. <row>
  366. <entry>
  367. <code>Zend_Ldap_Node appendToAttribute(string $name, mixed
  368. $value)</code>
  369. </entry>
  370. <entry>
  371. Appends to a <acronym>LDAP</acronym> attribute. Data conversion is applied
  372. using <methodname>Zend_Ldap_Attribute::setAttribute()</methodname>.
  373. </entry>
  374. </row>
  375. <row>
  376. <entry>
  377. <code>array|integer getDateTimeAttribute(string $name,
  378. integer|null $index)</code>
  379. </entry>
  380. <entry>
  381. Gets a <acronym>LDAP</acronym> date/time attribute. Data conversion is applied
  382. using
  383. <methodname>Zend_Ldap_Attribute::getDateTimeAttribute()</methodname>.
  384. </entry>
  385. </row>
  386. <row>
  387. <entry>
  388. <code>Zend_Ldap_Node setDateTimeAttribute(string $name,
  389. integer|array $value, boolean $utc)</code>
  390. </entry>
  391. <entry>
  392. Sets a <acronym>LDAP</acronym> date/time attribute. Data conversion is applied
  393. using
  394. <methodname>Zend_Ldap_Attribute::setDateTimeAttribute()</methodname>.
  395. </entry>
  396. </row>
  397. <row>
  398. <entry>
  399. <code>Zend_Ldap_Node appendToDateTimeAttribute(string $name,
  400. integer|array $value, boolean $utc)</code>
  401. </entry>
  402. <entry>
  403. Appends to a <acronym>LDAP</acronym> date/time attribute. Data conversion is
  404. applied using
  405. <methodname>Zend_Ldap_Attribute::setDateTimeAttribute()</methodname>.
  406. </entry>
  407. </row>
  408. <row>
  409. <entry>
  410. <code>Zend_Ldap_Node setPasswordAttribute(string $password,
  411. string $hashType, string $attribName)</code>
  412. </entry>
  413. <entry>
  414. Sets a <acronym>LDAP</acronym> password on <varname>$attribName</varname> (defaults
  415. to <code>'userPassword'</code>) to <varname>$password</varname> with the
  416. hash type <varname>$hashType</varname> (defaults to
  417. <constant>Zend_Ldap_Attribute::PASSWORD_HASH_MD5</constant>).
  418. </entry>
  419. </row>
  420. <row>
  421. <entry>
  422. <code>Zend_Ldap_Node deleteAttribute(string
  423. $name)</code>
  424. </entry>
  425. <entry>Deletes a <acronym>LDAP</acronym> attribute.</entry>
  426. </row>
  427. <row>
  428. <entry>
  429. <code>void removeDuplicatesFromAttribute(string
  430. $name)</code>
  431. </entry>
  432. <entry>Removes duplicate values from a <acronym>LDAP</acronym> attribute.</entry>
  433. </row>
  434. <row>
  435. <entry>
  436. <code>void removeFromAttribute(string $attribName,
  437. mixed|array $value)</code>
  438. </entry>
  439. <entry>Removes the given values from a <acronym>LDAP</acronym> attribute.</entry>
  440. </row>
  441. <row>
  442. <entry><code>boolean exists(Zend_Ldap $ldap)</code></entry>
  443. <entry>
  444. Checks if the current node exists on the given <acronym>LDAP</acronym> server
  445. (current server is used if <constant>NULL</constant> is passed).
  446. </entry>
  447. </row>
  448. <row>
  449. <entry><code>Zend_Ldap_Node reload(Zend_Ldap $ldap)</code></entry>
  450. <entry>
  451. Reloads the current node's attributes from the given <acronym>LDAP</acronym>
  452. server (current server is used if <constant>NULL</constant> is
  453. passed).
  454. </entry>
  455. </row>
  456. <row>
  457. <entry>
  458. <code>Zend_Ldap_Node_Collection
  459. searchSubtree(string|Zend_Ldap_Filter_Abstract $filter, integer
  460. $scope, string $sort)</code>
  461. </entry>
  462. <entry>
  463. Searches the nodes's subtree with the given
  464. <varname>$filter</varname> and the given search parameters. See
  465. <methodname>Zend_Ldap::search()</methodname> for details on the parameters
  466. <varname>$scope</varname> and <varname>$sort</varname>.
  467. </entry>
  468. </row>
  469. <row>
  470. <entry>
  471. <code>integer countSubtree(string|Zend_Ldap_Filter_Abstract
  472. $filter, integer $scope)</code>
  473. </entry>
  474. <entry>
  475. Count the nodes's subtree items matching the given
  476. <varname>$filter</varname> and the given search scope. See
  477. <methodname>Zend_Ldap::search()</methodname> for details on the
  478. <varname>$scope</varname> parameter.
  479. </entry>
  480. </row>
  481. <row>
  482. <entry><code>integer countChildren()</code></entry>
  483. <entry>Count the nodes's children.</entry>
  484. </row>
  485. <row>
  486. <entry>
  487. <code>Zend_Ldap_Node_Collection
  488. searchChildren(string|Zend_Ldap_Filter_Abstract $filter, string
  489. $sort)</code>
  490. </entry>
  491. <entry>
  492. Searches the nodes's children matching the given
  493. <varname>$filter</varname>. See <methodname>Zend_Ldap::search()</methodname> for
  494. details on the <varname>$sort</varname> parameter.
  495. </entry>
  496. </row>
  497. <row>
  498. <entry><code>boolean hasChildren()</code></entry>
  499. <entry>Returns whether the current node has children.</entry>
  500. </row>
  501. <row>
  502. <entry>
  503. <code>Zend_Ldap_Node_ChildrenIterator
  504. getChildren()</code>
  505. </entry>
  506. <entry>Returns all children of the current node.</entry>
  507. </row>
  508. <row>
  509. <entry>
  510. <code>Zend_Ldap_Node getParent(Zend_Ldap
  511. $ldap)</code>
  512. </entry>
  513. <entry>
  514. Returns the parent of the current node using the <acronym>LDAP</acronym>
  515. connection <varname>$ldap</varname> (uses the current <acronym>LDAP</acronym> connection if
  516. omitted).
  517. </entry>
  518. </row>
  519. </tbody>
  520. </tgroup>
  521. </table>
  522. </sect3>