Zend_Ldap-API-Ldap-Node.xml 25 KB

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