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