Zend_Ldap-API-Ldap-Node.xml 24 KB

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