Browse Source

[DOCUMENTATION] Japanese:new Zend_Ldap Usage

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@16688 44c647ce-9c0f-0410-b52a-842ac1e357ba
yoshida@zend.co.jp 16 years ago
parent
commit
0e3620f3ab
1 changed files with 165 additions and 0 deletions
  1. 165 0
      documentation/manual/ja/module_specs/Zend_Ldap-Usage.xml

+ 165 - 0
documentation/manual/ja/module_specs/Zend_Ldap-Usage.xml

@@ -0,0 +1,165 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Reviewed: no -->
+<!-- EN-Revision: 16634 -->
+<sect1 id="zend.ldap.usage">
+    <title>利用シナリオ</title>
+    <sect2 id="zend.ldap.usage.authentication">
+        <title>認証シナリオ</title>
+
+        <sect3 id="zend.ldap.usage.authentication.openldap">
+            <title>OpenLDAP</title>
+            <para/>
+        </sect3>
+
+        <sect3 id="zend.ldap.usage.authentication.activedirectory">
+            <title>ActiveDirectory</title>
+            <para/>
+        </sect3>
+    </sect2>
+
+    <sect2 id="zend.ldap.usage.basic">
+        <title>基本的なCRUD操作</title>
+
+        <sect3 id="zend.ldap.usage.basic.retrieve">
+            <title>LDAPからデータを取得</title>
+            <example id="zend.ldap.usage.basic.retrieve.dn">
+                <title>そのDNで項目を取得</title>
+                <programlisting language="php"><![CDATA[
+$options = array(/* ... */);
+$ldap = new Zend_Ldap($options);
+$ldap->bind();
+$hm = $ldap->getEntry('cn=Hugo Müller,ou=People,dc=my,dc=local');
+/*
+$hm は下記の構造の配列
+array(
+    'dn'          => 'cn=Hugo Müller,ou=People,dc=my,dc=local',
+    'cn'          => array('Hugo Müller'),
+    'sn'          => array('Müller'),
+    'objectclass' => array('inetOrgPerson', 'top'),
+    ...
+)
+*/
+]]></programlisting>
+            </example>
+
+            <example id="zend.ldap.usage.basic.retrieve.exists">
+                <title>与えられたDNが存在するかチェック</title>
+                <programlisting language="php"><![CDATA[
+$options = array(/* ... */);
+$ldap = new Zend_Ldap($options);
+$ldap->bind();
+$isThere = $ldap->exists('cn=Hugo Müller,ou=People,dc=my,dc=local');
+]]></programlisting>
+            </example>
+
+            <example id="zend.ldap.usage.basic.retrieve.counting-children">
+                <title>与えられたDNの子供を数える</title>
+                <programlisting language="php"><![CDATA[
+$options = array(/* ... */);
+$ldap = new Zend_Ldap($options);
+$ldap->bind();
+$childrenCount = $ldap->countChildren(
+                            'cn=Hugo Müller,ou=People,dc=my,dc=local');
+]]></programlisting>
+        </example>
+
+            <example id="zend.ldap.usage.basic.retrieve.search">
+                <title>LDAPツリーを検索</title>
+                <programlisting language="php"><![CDATA[
+$options = array(/* ... */);
+$ldap = new Zend_Ldap($options);
+$ldap->bind();
+$result = $ldap->search('(objectclass=*)',
+                        'ou=People,dc=my,dc=local',
+                        Zend_Ldap_Ext::SEARCH_SCOPE_ONE);
+foreach ($result as $item) {
+    echo $item["dn"] . ': ' . $item['cn'][0] . PHP_EOL;
+}
+]]></programlisting>
+            </example>
+        </sect3>
+
+        <sect3 id="zend.ldap.usage.basic.add">
+            <title>LDAPにデータを追加</title>
+            <example>
+                <title>LDAPに新規項目を追加</title>
+                <programlisting language="php"><![CDATA[
+$options = array(/* ... */);
+$ldap = new Zend_Ldap($options);
+$ldap->bind();
+$entry = array();
+Zend_Ldap_Attribute::setAttribute($entry, 'cn', 'Hans Meier');
+Zend_Ldap_Attribute::setAttribute($entry, 'sn', 'Meier');
+Zend_Ldap_Attribute::setAttribute($entry, 'objectClass', 'inetOrgPerson');
+$ldap->add('cn=Hans Meier,ou=People,dc=my,dc=local', $entry);
+]]></programlisting>
+                </example>
+        </sect3>
+
+        <sect3 id="zend.ldap.usage.basic.delete">
+            <title>LDAPからデータを削除</title>
+            <example>
+                <title>LDAPから存在する項目を削除</title>
+                <programlisting language="php"><![CDATA[
+$options = array(/* ... */);
+$ldap = new Zend_Ldap($options);
+$ldap->bind();
+$ldap->delete('cn=Hans Meier,ou=People,dc=my,dc=local');
+]]></programlisting>
+                </example>
+        </sect3>
+
+        <sect3 id="zend.ldap.usage.basic.update">
+            <title>LDAPを更新</title>
+            <example>
+                <title>LDAPに存在する項目を更新</title>
+                <programlisting language="php"><![CDATA[
+$options = array(/* ... */);
+$ldap = new Zend_Ldap($options);
+$ldap->bind();
+$hm = $ldap->getEntry('cn=Hugo Müller,ou=People,dc=my,dc=local');
+Zend_Ldap_Attribute::setAttribute($hm, 'mail', 'mueller@my.local');
+Zend_Ldap_Attribute::setPassword($hm,
+                                 'newPa$$w0rd',
+                                 Zend_Ldap_Attribute::PASSWORD_HASH_SHA1);
+$ldap->update('cn=Hugo Müller,ou=People,dc=my,dc=local', $hm);
+]]></programlisting>
+                </example>
+        </sect3>
+    </sect2>
+
+    <sect2 id="zend.ldap.usage.extended">
+        <title>拡張された操作</title>
+
+        <sect3 id="zend.ldap.usage.extended.copy-and-move">
+            <title>LDAPで項目をコピーまたは移動</title>
+
+            <example id="zend.ldap.usage.extended.copy-and-move.copy">
+                <title>LDAP項目をその全ての派生物と共に再帰的にコピー</title>
+                <programlisting language="php"><![CDATA[
+$options = array(/* ... */);
+$ldap = new Zend_Ldap($options);
+$ldap->bind();
+$ldap->copy('cn=Hugo Müller,ou=People,dc=my,dc=local',
+            'cn=Hans Meier,ou=People,dc=my,dc=local',
+            true);
+]]></programlisting>
+            </example>
+
+            <example id="zend.ldap.usage.extended.copy-and-move.move-to-subtree">
+                <title>
+                    LDAP項目をその全ての派生物と共に再帰的に異なるサブツリーに移動
+                </title>
+                <programlisting language="php"><![CDATA[
+$options = array(/* ... */);
+$ldap = new Zend_Ldap($options);
+$ldap->bind();
+$ldap->moveToSubtree('cn=Hugo Müller,ou=People,dc=my,dc=local',
+                     'ou=Dismissed,dc=my,dc=local',
+                     true);
+]]></programlisting>
+            </example>
+
+        </sect3>
+    </sect2>
+</sect1>