[GENERIC] Zend_Translate:
[zend.git] / documentation / manual / ja / module_specs / Zend_Ldap-Usage.xml
blobc3bba02d1c381828edfafa670326a7dcc4ac2151
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!-- Reviewed: no -->
3 <!-- EN-Revision: 20792 -->
4 <sect1 id="zend.ldap.usage">
5     <title>利用シナリオ</title>
6     <sect2 id="zend.ldap.usage.authentication">
7         <title>認証シナリオ</title>
9         <sect3 id="zend.ldap.usage.authentication.openldap">
10             <title>OpenLDAP</title>
11             <para/>
12         </sect3>
14         <sect3 id="zend.ldap.usage.authentication.activedirectory">
15             <title>ActiveDirectory</title>
16             <para/>
17         </sect3>
18     </sect2>
20     <sect2 id="zend.ldap.usage.basic">
21         <title>基本的なCRUD操作</title>
23         <sect3 id="zend.ldap.usage.basic.retrieve">
24             <title>LDAPからデータを取得</title>
25             <example id="zend.ldap.usage.basic.retrieve.dn">
26                 <title>そのDNで項目を取得</title>
27                 <programlisting language="php"><![CDATA[
28 $options = array(/* ... */);
29 $ldap = new Zend_Ldap($options);
30 $ldap->bind();
31 $hm = $ldap->getEntry('cn=Hugo Müller,ou=People,dc=my,dc=local');
33 $hm は下記の構造の配列
34 array(
35     'dn'          => 'cn=Hugo Müller,ou=People,dc=my,dc=local',
36     'cn'          => array('Hugo Müller'),
37     'sn'          => array('Müller'),
38     'objectclass' => array('inetOrgPerson', 'top'),
39     ...
42 ]]></programlisting>
43             </example>
45             <example id="zend.ldap.usage.basic.retrieve.exists">
46                 <title>与えられたDNが存在するかチェック</title>
47                 <programlisting language="php"><![CDATA[
48 $options = array(/* ... */);
49 $ldap = new Zend_Ldap($options);
50 $ldap->bind();
51 $isThere = $ldap->exists('cn=Hugo Müller,ou=People,dc=my,dc=local');
52 ]]></programlisting>
53             </example>
55             <example id="zend.ldap.usage.basic.retrieve.counting-children">
56                 <title>与えられたDNの子供を数える</title>
57                 <programlisting language="php"><![CDATA[
58 $options = array(/* ... */);
59 $ldap = new Zend_Ldap($options);
60 $ldap->bind();
61 $childrenCount = $ldap->countChildren(
62                             'cn=Hugo Müller,ou=People,dc=my,dc=local');
63 ]]></programlisting>
64         </example>
66             <example id="zend.ldap.usage.basic.retrieve.search">
67                 <title>LDAPツリーを検索</title>
68                 <programlisting language="php"><![CDATA[
69 $options = array(/* ... */);
70 $ldap = new Zend_Ldap($options);
71 $ldap->bind();
72 $result = $ldap->search('(objectclass=*)',
73                         'ou=People,dc=my,dc=local',
74                         Zend_Ldap_Ext::SEARCH_SCOPE_ONE);
75 foreach ($result as $item) {
76     echo $item["dn"] . ': ' . $item['cn'][0] . PHP_EOL;
78 ]]></programlisting>
79             </example>
80         </sect3>
82         <sect3 id="zend.ldap.usage.basic.add">
83             <title>LDAPにデータを追加</title>
84             <example>
85                 <title>LDAPに新規項目を追加</title>
86                 <programlisting language="php"><![CDATA[
87 $options = array(/* ... */);
88 $ldap = new Zend_Ldap($options);
89 $ldap->bind();
90 $entry = array();
91 Zend_Ldap_Attribute::setAttribute($entry, 'cn', 'Hans Meier');
92 Zend_Ldap_Attribute::setAttribute($entry, 'sn', 'Meier');
93 Zend_Ldap_Attribute::setAttribute($entry, 'objectClass', 'inetOrgPerson');
94 $ldap->add('cn=Hans Meier,ou=People,dc=my,dc=local', $entry);
95 ]]></programlisting>
96                 </example>
97         </sect3>
99         <sect3 id="zend.ldap.usage.basic.delete">
100             <title>LDAPからデータを削除</title>
101             <example>
102                 <title>LDAPから存在する項目を削除</title>
103                 <programlisting language="php"><![CDATA[
104 $options = array(/* ... */);
105 $ldap = new Zend_Ldap($options);
106 $ldap->bind();
107 $ldap->delete('cn=Hans Meier,ou=People,dc=my,dc=local');
108 ]]></programlisting>
109                 </example>
110         </sect3>
112         <sect3 id="zend.ldap.usage.basic.update">
113             <title>LDAPを更新</title>
114             <example>
115                 <title>LDAPに存在する項目を更新</title>
116                 <programlisting language="php"><![CDATA[
117 $options = array(/* ... */);
118 $ldap = new Zend_Ldap($options);
119 $ldap->bind();
120 $hm = $ldap->getEntry('cn=Hugo Müller,ou=People,dc=my,dc=local');
121 Zend_Ldap_Attribute::setAttribute($hm, 'mail', 'mueller@my.local');
122 Zend_Ldap_Attribute::setPassword($hm,
123                                  'newPa$$w0rd',
124                                  Zend_Ldap_Attribute::PASSWORD_HASH_SHA1);
125 $ldap->update('cn=Hugo Müller,ou=People,dc=my,dc=local', $hm);
126 ]]></programlisting>
127                 </example>
128         </sect3>
129     </sect2>
131     <sect2 id="zend.ldap.usage.extended">
132         <title>拡張された操作</title>
134         <sect3 id="zend.ldap.usage.extended.copy-and-move">
135             <title>LDAPで項目をコピーまたは移動</title>
137             <example id="zend.ldap.usage.extended.copy-and-move.copy">
138                 <title>LDAP項目をその全ての派生物と共に再帰的にコピー</title>
139                 <programlisting language="php"><![CDATA[
140 $options = array(/* ... */);
141 $ldap = new Zend_Ldap($options);
142 $ldap->bind();
143 $ldap->copy('cn=Hugo Müller,ou=People,dc=my,dc=local',
144             'cn=Hans Meier,ou=People,dc=my,dc=local',
145             true);
146 ]]></programlisting>
147             </example>
149             <example id="zend.ldap.usage.extended.copy-and-move.move-to-subtree">
150                 <title>
151                     LDAP項目をその全ての派生物と共に再帰的に異なるサブツリーに移動
152                 </title>
153                 <programlisting language="php"><![CDATA[
154 $options = array(/* ... */);
155 $ldap = new Zend_Ldap($options);
156 $ldap->bind();
157 $ldap->moveToSubtree('cn=Hugo Müller,ou=People,dc=my,dc=local',
158                      'ou=Dismissed,dc=my,dc=local',
159                      true);
160 ]]></programlisting>
161             </example>
163         </sect3>
164     </sect2>
165 </sect1>