Zend_Ldap-API-Ldap-Dn.xml 14 KB

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