Zend_Ldap-API-Ldap-Dn.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- EN-Revision: 16831 -->
  3. <!-- Reviewed: no -->
  4. <sect3 id="zend.ldap.api.reference.zend-ldap-dn">
  5. <title>Zend_Ldap_Dn</title>
  6. <para>
  7. <classname>Zend_Ldap_Dn</classname> provides an object-oriented interface to
  8. manipulating <acronym>LDAP</acronym> distinguished names (DN). The parameter <code>$caseFold</code>
  9. that is used in several methods determines the way DN attributes are handled
  10. regarding their case. Allowed values for this paraneter are:
  11. </para>
  12. <variablelist>
  13. <varlistentry>
  14. <term><code>Zend_Ldap_Dn::ATTR_CASEFOLD_NONE</code></term>
  15. <listitem><para>No case-folding will be done.</para></listitem>
  16. </varlistentry>
  17. <varlistentry>
  18. <term><code>Zend_Ldap_Dn::ATTR_CASEFOLD_UPPER</code></term>
  19. <listitem><para>All attributes will be converted to upper-case.</para></listitem>
  20. </varlistentry>
  21. <varlistentry>
  22. <term><code>Zend_Ldap_Dn::ATTR_CASEFOLD_LOWER</code></term>
  23. <listitem><para>All attributes will be converted to lower-case.</para></listitem>
  24. </varlistentry>
  25. </variablelist>
  26. <para>
  27. The default case-folding is <code>Zend_Ldap_Dn::ATTR_CASEFOLD_NONE</code> and
  28. can be set with <code>Zend_Ldap_Dn::setDefaultCaseFold()</code>. Each instance of
  29. <classname>Zend_Ldap_Dn</classname> can have its own case-folding-setting. If the
  30. <code>$caseFold</code> parameter is ommitted in method-calls it defaults to the
  31. instance's case-folding setting.
  32. </para>
  33. <para>
  34. The class implements <code>ArrayAccess</code> to allow indexer-access to the
  35. different parts of the DN. The <code>ArrayAccess</code>-methods proxy to
  36. <code>Zend_Ldap_Dn::get($offset, 1, null)</code> for <code>offsetGet(integer
  37. $offset)</code>, to <code>Zend_Ldap_Dn::set($offset, $value)</code> for
  38. <code>offsetSet()</code> and to <code>Zend_Ldap_Dn::remove($offset, 1)</code> for
  39. <code>offsetUnset()</code>. <code>offsetExists()</code> simply checks if the index
  40. is within the bounds.
  41. </para>
  42. <table id="zend.ldap.api.reference.zend-ldap-dn.table">
  43. <title>Zend_Ldap_Dn API</title>
  44. <tgroup cols="2">
  45. <thead>
  46. <row>
  47. <entry>Method</entry>
  48. <entry>Description</entry>
  49. </row>
  50. </thead>
  51. <tbody>
  52. <row>
  53. <entry>
  54. <emphasis><code>Zend_Ldap_Dn factory(string|array $dn,
  55. string|null $caseFold)</code> </emphasis>
  56. </entry>
  57. <entry>
  58. Creates a <classname>Zend_Ldap_Dn</classname> instance from an array
  59. or a string. The array must conform to the array structure detailed
  60. under <code>Zend_Ldap_Dn::implodeDn()</code>.
  61. </entry>
  62. </row>
  63. <row>
  64. <entry>
  65. <emphasis><code>Zend_Ldap_Dn fromString(string $dn,
  66. string|null $caseFold)</code> </emphasis>
  67. </entry>
  68. <entry>
  69. Creates a <classname>Zend_Ldap_Dn</classname> instance from a
  70. string.
  71. </entry>
  72. </row>
  73. <row>
  74. <entry>
  75. <emphasis><code>Zend_Ldap_Dn fromArray(array $dn,
  76. string|null $caseFold)</code> </emphasis>
  77. </entry>
  78. <entry>
  79. Creates a <classname>Zend_Ldap_Dn</classname> instance from an array.
  80. The array must conform to the array structure detailed under
  81. <code>Zend_Ldap_Dn::implodeDn()</code>.
  82. </entry>
  83. </row>
  84. <row>
  85. <entry><code>array getRdn(string|null $caseFold)</code></entry>
  86. <entry>
  87. Gets the <acronym>RDN</acronym> of the current DN. The return value is an array
  88. with the <acronym>RDN</acronym> attribute names its keys and the <acronym>RDN</acronym> attribute
  89. values.
  90. </entry>
  91. </row>
  92. <row>
  93. <entry>
  94. <code>string getRdnString(string|null
  95. $caseFold)</code>
  96. </entry>
  97. <entry>
  98. Gets the <acronym>RDN</acronym> of the current DN. The return value is a
  99. string.
  100. </entry>
  101. </row>
  102. <row>
  103. <entry>
  104. <code>Zend_Ldap_Dn getParentDn(integer
  105. $levelUp)</code>
  106. </entry>
  107. <entry>
  108. Gets the DN of the current DN's ancestor
  109. <code>$levelUp</code> levels up the tree. <code>$levelUp</code>
  110. defaults to <code>1</code>.
  111. </entry>
  112. </row>
  113. <row>
  114. <entry>
  115. <code>array get(integer $index, integer $length, string|null
  116. $caseFold)</code>
  117. </entry>
  118. <entry>
  119. Returns a slice of the current DN determined by
  120. <code>$index</code> and <code>$length</code>. <code>$index</code>
  121. starts with <code>0</code> on the DN part from the left.
  122. </entry>
  123. </row>
  124. <row>
  125. <entry>
  126. <code>Zend_Ldap_Dn set(integer $index, array
  127. $value)</code>
  128. </entry>
  129. <entry>
  130. Replaces a DN part in the current DN. This operation
  131. manipulates the current instance.
  132. </entry>
  133. </row>
  134. <row>
  135. <entry>
  136. <code>Zend_Ldap_Dn remove(integer $index, integer
  137. $length)</code>
  138. </entry>
  139. <entry>
  140. Removes a DN part from the current DN. This operation
  141. manipulates the current instance. <code>$length</code> defaults to
  142. <code>1</code>
  143. </entry>
  144. </row>
  145. <row>
  146. <entry><code>Zend_Ldap_Dn append(array $value)</code></entry>
  147. <entry>
  148. Appends a DN part to the current DN. This operation
  149. manipulates the current instance.
  150. </entry>
  151. </row>
  152. <row>
  153. <entry><code>Zend_Ldap_Dn prepend(array $value)</code></entry>
  154. <entry>
  155. Prepends a DN part to the current DN. This operation
  156. manipulates the current instance.
  157. </entry>
  158. </row>
  159. <row>
  160. <entry>
  161. <code>Zend_Ldap_Dn insert(integer $index, array
  162. $value)</code>
  163. </entry>
  164. <entry>
  165. Inserts a DN part after the index <code>$index</code> to the
  166. current DN. This operation manipulates the current
  167. instance.
  168. </entry>
  169. </row>
  170. <row>
  171. <entry><code>void setCaseFold(string|null $caseFold)</code></entry>
  172. <entry>
  173. Sets the case-folding option to the current DN instance. If
  174. <code>$caseFold</code> is null the default case-folding setting
  175. (<code>Zend_Ldap_Dn::ATTR_CASEFOLD_NONE</code> by default or set
  176. via <code>Zend_Ldap_Dn::setDefaultCaseFold()</code> will be set for
  177. the current instance.
  178. </entry>
  179. </row>
  180. <row>
  181. <entry><code>string toString(string|null $caseFold)</code></entry>
  182. <entry>Returns DN as a string.</entry>
  183. </row>
  184. <row>
  185. <entry><code>array toArray(string|null $caseFold)</code></entry>
  186. <entry>Returns DN as an array.</entry>
  187. </row>
  188. <row>
  189. <entry><code>string __toString()</code></entry>
  190. <entry>
  191. Returns DN as a string - proxies to
  192. <code>Zend_Ldap_Dn::toString(null)</code>.
  193. </entry>
  194. </row>
  195. <row>
  196. <entry>
  197. <emphasis><code>void setDefaultCaseFold(string
  198. $caseFold)</code> </emphasis>
  199. </entry>
  200. <entry>
  201. Sets the default case-folding option used by all instances
  202. on creation by default. Already existing instances are not affected
  203. by this setting.
  204. </entry>
  205. </row>
  206. <row>
  207. <entry>
  208. <emphasis><code>array escapeValue(string|array
  209. $values)</code> </emphasis>
  210. </entry>
  211. <entry>Escapes a DN value according to RFC 2253.</entry>
  212. </row>
  213. <row>
  214. <entry>
  215. <emphasis><code>array unescapeValue(string|array
  216. $values)</code> </emphasis>
  217. </entry>
  218. <entry>
  219. Undoes the conversion done by
  220. <code>Zend_Ldap_Dn::escapeValue()</code>.
  221. </entry>
  222. </row>
  223. <row>
  224. <entry>
  225. <emphasis><code>array explodeDn(string $dn, array
  226. &amp;$keys, array &amp;$vals, string|null $caseFold)</code>
  227. </emphasis>
  228. </entry>
  229. <entry>
  230. Explodes the DN <code>$dn</code> into an array containing
  231. all parts of the given DN. <code>$keys</code> optinally receive DN
  232. keys (e.g. CN, OU, DC, ...). <code>$vals</code> optionally receive
  233. DN values. The resulting array will be of type
  234. <programlisting language="php"><![CDATA[
  235. array(
  236. array("cn" => "name1", "uid" => "user"),
  237. array("cn" => "name2"),
  238. array("dc" => "example"),
  239. array("dc" => "org")
  240. )
  241. ]]></programlisting>for a DN of <code>cn=name1+uid=user,cn=name2,dc=example,dc=org</code>.
  242. </entry>
  243. </row>
  244. <row>
  245. <entry>
  246. <emphasis><code>boolean checkDn(string $dn, array
  247. &amp;$keys, array &amp;$vals, string|null $caseFold)</code>
  248. </emphasis>
  249. </entry>
  250. <entry>
  251. Checks if a given DN <code>$dn</code> is malformed. If
  252. <code>$keys</code> or <code>$keys</code> and <code>$vals</code> are
  253. given, these arrays will be filled with the appropriate DN keys and
  254. values.
  255. </entry>
  256. </row>
  257. <row>
  258. <entry>
  259. <emphasis><code>string implodeRdn(array $part, string|null
  260. $caseFold)</code> </emphasis>
  261. </entry>
  262. <entry>
  263. Returns a DN part in the form
  264. <code>$attribute=$value</code>
  265. </entry>
  266. </row>
  267. <row>
  268. <entry>
  269. <emphasis><code>string implodeDn(array $dnArray,
  270. string|null $caseFold, string $separator)</code>
  271. </emphasis>
  272. </entry>
  273. <entry>
  274. Implodes an array in the form delivered by
  275. <code>Zend_Ldap_Dn::explodeDn()</code> to a DN string.
  276. <code>$separator</code> defaults to <code>','</code> but some LDAP
  277. servers also understand <code>';'</code>. <code>$dnArray</code>
  278. must of type
  279. <programlisting language="php"><![CDATA[
  280. array(
  281. array("cn" => "name1", "uid" => "user"),
  282. array("cn" => "name2"),
  283. array("dc" => "example"),
  284. array("dc" => "org")
  285. )
  286. ]]></programlisting>
  287. </entry>
  288. </row>
  289. <row>
  290. <entry>
  291. <emphasis><code>boolean isChildOf(string|Zend_Ldap_Dn
  292. $childDn, string|Zend_Ldap_Dn $parentDn)</code> </emphasis>
  293. </entry>
  294. <entry>
  295. Checks if given <code>$childDn</code> is beneath
  296. <code>$parentDn</code> subtree.
  297. </entry>
  298. </row>
  299. </tbody>
  300. </tgroup>
  301. </table>
  302. </sect3>