51f26b878a48598f07632dfaed26254e5742b185
[moodle.git] / auth / ldap / config.html
1 <?php
3     // set to defaults if undefined
4     if (!isset($config->host_url))
5         { $config->host_url = ''; }
6     if (empty($config->ldapencoding))
7         { $config->ldapencoding = 'utf-8'; }
8     if (!isset($config->contexts))
9         { $config->contexts = ''; }
10     if (!isset($config->user_type))
11         { $config->user_type = 'default'; }
12     if (!isset($config->user_attribute))
13         { $config->user_attribute = ''; }
14     if (!isset($config->search_sub))
15         { $config->search_sub = ''; }
16     if (!isset($config->opt_deref))
17         { $config->opt_deref = LDAP_DEREF_NEVER; }
18     if (!isset($config->preventpassindb))
19         { $config->preventpassindb = 1; }
20     if (!isset($config->bind_dn))
21         {$config->bind_dn = ''; }
22     if (!isset($config->bind_pw))
23         {$config->bind_pw = ''; }
24     if (!isset($config->version))
25         {$config->version = '2'; }
26     if (!isset($config->objectclass))
27         {$config->objectclass = ''; }
28     if (!isset($config->memberattribute))
29         {$config->memberattribute = ''; }
30     if (!isset($config->memberattribute_isdn))
31         {$config->memberattribute_isdn = ''; }
32     if (!isset($config->creators))
33         {$config->creators = ''; }
34     if (!isset($config->create_context))
35         {$config->create_context = ''; }
36     if (!isset($config->expiration))
37         {$config->expiration = ''; }
38     if (!isset($config->expiration_warning))
39         {$config->expiration_warning = '10'; }
40     if (!isset($config->expireattr))
41         {$config->expireattr = ''; }
42     if (!isset($config->gracelogins))
43         {$config->gracelogins = ''; }
44     if (!isset($config->graceattr))
45         {$config->graceattr = ''; }
46     if (!isset($config->auth_user_create))
47         {$config->auth_user_create = ''; }
48     if (!isset($config->forcechangepassword))
49         {$config->forcechangepassword = 0; }
50     if (!isset($config->stdchangepassword))
51         {$config->stdchangepassword = 0; }
52     if (!isset($config->passtype))
53         {$config->passtype = 'plaintext';}
54     if (!isset($config->changepasswordurl))
55         {$config->changepasswordurl = ''; }
56     if (!isset($config->removeuser))
57         {$config->removeuser = AUTH_REMOVEUSER_KEEP; }
58     if (!isset($config->ntlmsso_enabled))
59         {$config->ntlmsso_enabled = 0; }
60     if (!isset($config->ntlmsso_subnet))
61         {$config->ntlmsso_subnet = ''; }
62     if (!isset($config->ntlmsso_ie_fastpath))
63         {$config->ntlmsso_ie_fastpath = 0; }
65     $yesno = array( get_string('no'), get_string('yes') );
67 if (!function_exists('ldap_connect')) { // Is php4-ldap really there?
68     echo $OUTPUT->notification(get_string('auth_ldap_noextension','auth_ldap'));
69 }
71 ?>
72 <table cellspacing="0" cellpadding="5" border="0">
74 <tr>
75    <td colspan="2">
76         <h4><?php print_string('auth_ldap_server_settings', 'auth_ldap') ?> </h4>
77    </td>
78 </tr>
80 <tr valign="top" class="required">
81     <td align="right"><label for="host_url"><?php print_string('auth_ldap_host_url_key','auth_ldap') ?></label></td>
82     <td>
83         <input name="host_url" id="host_url" type="text" size="30" value="<?php echo $config->host_url?>" />
84     <?php  if (isset($err['host_url'])) echo $OUTPUT->error_text($err['host_url']); ?>
85     </td>
86     <td>
87     <?php print_string('auth_ldap_host_url','auth_ldap') ?>
88     </td>
89 </tr>
91 <tr valign="top" class="required">
92     <td align="right"><label for="menuversion"><?php print_string('auth_ldap_version_key','auth_ldap') ?></label></td>
93     <td>
94     <?php
95        $versions = array();
96        $versions[2] = '2';
97        $versions[3] = '3';
98        echo $OUTPUT->select(html_select::make($versions, 'version', $config->version, false));
99        if (isset($err['version'])) echo $OUTPUT->error_text($err['version']);
100     ?>
101     </td>
102     <td>
103     <?php print_string('auth_ldap_version','auth_ldap') ?>
104     </td>
105 </tr>
107 <tr valign="top" class="required">
108     <td align="right"><label for="ldapencoding"><?php print_string("auth_ldap_ldap_encoding_key", "auth_ldap") ?></label></td>
109     <td>
110         <input id="ldapencoding" name="ldapencoding" type="text" value="<?php echo $config->ldapencoding ?>" />
111         <?php
113         if (isset($err['ldapencoding'])) {
114             echo $OUTPUT->error_text($err['ldapencoding']);
115         }
117         ?>
118     </td>
119     <td><?php print_string('auth_ldap_ldap_encoding', 'auth_ldap') ?></td>
120 </tr>
122 <tr>
123    <td colspan="2">
124         <h4><?php print_string('auth_ldap_bind_settings', 'auth_ldap') ?> </h4>
125    </td>
126 </tr>
128 <tr valign="top" class="required">
129     <td align="right"><label for="menupreventpassindb"><?php print_string('auth_ldap_preventpassindb_key','auth_ldap') ?></label></td>
130     <td>
131         <?php echo $OUTPUT->select(html_select::make($yesno, 'preventpassindb', $config->preventpassindb, false)); ?>
132     </td><td>
133     <?php print_string('auth_ldap_preventpassindb','auth_ldap') ?>
134     </td>
135 </tr>
137 <tr valign="top" class="required">
138     <td align="right"><label for="bind_dn"><?php print_string('auth_ldap_bind_dn_key','auth_ldap') ?></label></td>
139     <td>
140     <input name="bind_dn" id="bind_dn" type="text" size="30" value="<?php echo $config->bind_dn?>" />
141     <?php  if (isset($err['bind_dn'])) echo $OUTPUT->error_text($err['bind_dn']); ?>
142     </td><td>
143     <?php print_string('auth_ldap_bind_dn','auth_ldap') ?>
144     </td>
145 </tr>
147 <tr valign="top" class="required">
148     <td align="right"><label for="bind_pw"><?php print_string('auth_ldap_bind_pw_key','auth_ldap') ?></label></td>
149     <td>
150     <input name="bind_pw" id="bind_pw" type="password" size="30" value="<?php echo $config->bind_pw?>" />
151     <?php  if (isset($err['bind_pw'])) echo $OUTPUT->error_text($err['bind_pw']); ?>
152     </td><td>
153     <?php print_string('auth_ldap_bind_pw','auth_ldap') ?>
154     </td>
155 </tr>
157 <tr>
158    <td colspan="2">
159         <h4><?php print_string('auth_ldap_user_settings', 'auth_ldap') ?> </h4>
160    </td>
161 </tr>
163 <tr valign="top" class="required">
164     <td align="right"><label for="menuuser_type"><?php print_string('auth_ldap_user_type_key','auth_ldap') ?></label></td>
165     <td>
166     <?php echo $OUTPUT->select(html_select::make($this->ldap_suppported_usertypes(), 'user_type', $config->user_type, false)); ?>
167     <?php  if (isset($err['user_type'])) echo $OUTPUT->error_text($err['user_type']); ?>
168     </td>
169     <td>
170     <?php print_string('auth_ldap_user_type', 'auth_ldap') ?>
171     </td>
172 </tr>
174 <tr valign="top" class="required">
175     <td align="right"><label for="contexts"><?php print_string('auth_ldap_contexts_key','auth_ldap') ?></label></td>
176     <td>
177     <input name="contexts" id="contexts"  type="text" size="30" value="<?php echo $config->contexts?>" />
178     <?php  if (isset($err['contexts'])) echo $OUTPUT->error_text($err['contexts']); ?>
179     </td>
180     <td>
181     <?php print_string('auth_ldap_contexts', 'auth_ldap') ?>
182     </td>
183 </tr>
185 <tr valign="top" class="required">
186     <td align="right"><label for="menusearch_sub"><?php print_string('auth_ldap_search_sub_key','auth_ldap') ?></label></td>
187     <td>
188         <?php echo $OUTPUT->select(html_select::make($yesno, 'search_sub', $config->search_sub, false)); ?>
189     </td>
190     <td>
191     <?php print_string('auth_ldap_search_sub','auth_ldap') ?>
192     </td>
193 </tr>
195 <tr valign="top" class="required">
196     <td align="right"><label for="menuopt_deref"><?php print_string('auth_ldap_opt_deref_key','auth_ldap') ?></label></td>
197     <td>
198     <?php
199        $opt_deref = array();
200        $opt_deref[LDAP_DEREF_NEVER] = get_string('no');
201        $opt_deref[LDAP_DEREF_ALWAYS] = get_string('yes');
202        echo $OUTPUT->select(html_select::make($opt_deref, 'opt_deref', $config->opt_deref, LDAP_DEREF_NEVER, false));
203        if (isset($err['opt_deref'])) echo $OUTPUT->error_text($err['opt_deref']);
204     ?>
205     </td>
206     <td>
207     <?php print_string('auth_ldap_opt_deref','auth_ldap') ?>
208     </td>
209 </tr>
213 <tr valign="top" class="required">
214     <td align="right"><label for="user_attribute"><?php print_string('auth_ldap_user_attribute_key','auth_ldap') ?></label></td>
215     <td>
216     <input name="user_attribute" id="user_attribute" type="text" size="30" value="<?php echo $config->user_attribute?>" />
217     <?php  if (isset($err['user_attribute'])) echo $OUTPUT->error_text($err['user_attribute']); ?>
218     </td>
219     <td>
220     <?php print_string('auth_ldap_user_attribute','auth_ldap') ?>
221     </td>
222 </tr>
224 <tr valign="top" class="required">
225         <td align="right"><label for="memberattribute"><?php print_string('auth_ldap_memberattribute_key','auth_ldap') ?></label></td>
226         <td>
227     <input name="memberattribute" id="memberattribute" type="text" size="30" value="<?php echo $config->memberattribute?>" />
228     <?php  if (isset($err['memberattribute'])) echo $OUTPUT->error_text($err['memberattribute']); ?>
229     </td><td>
230     <?php print_string('auth_ldap_memberattribute','auth_ldap') ?>
231     </td>
232 </tr>
234 <tr valign="top" class="required">
235         <td align="right"><label for="memberattribute_isdn"><?php print_string('auth_ldap_memberattribute_isdn_key','auth_ldap') ?></label></td>
236         <td>
237     <input name="memberattribute_isdn" id="memberattribute_isdn" type="text" size="30" value="<?php echo $config->memberattribute_isdn?>" />
238     <?php  if (isset($err['memberattribute_isdn'])) echo $OUTPUT->error_text($err['memberattribute_isdn']); ?>
239     </td><td>
240     <?php print_string('auth_ldap_memberattribute_isdn','auth_ldap') ?>
241     </td>
242 </tr>
244 <tr valign="top" class="required">
245     <td align="right"><label for="objectclass"><?php print_string('auth_ldap_objectclass_key','auth_ldap') ?></label></td>
246     <td>
247     <input name="objectclass" id="objectclass" type="text" size="30" value="<?php echo $config->objectclass?>" />
248     <?php  if (isset($err['objectclass'])) echo $OUTPUT->error_text($err['objectclass']); ?>
249     </td>
250     <td>
251     <?php print_string('auth_ldap_objectclass','auth_ldap') ?>
252     </td>
253 </tr>
255 <tr>
256    <td colspan="2">
257         <h4><?php print_string('forcechangepassword', 'auth') ?> </h4>
258    </td>
259 </tr>
261 <tr valign="top" class="required">
262     <td align="right" valign="top"><label for="menuforcechangepassword"><?php print_string('forcechangepassword', 'auth') ?></label></td>
263     <td>
264         <?php echo $OUTPUT->select(html_select::make($yesno, 'forcechangepassword', $config->forcechangepassword, false)); ?>
265     </td>
266     <td align="left" valign="top">
267         <p><?php print_string('forcechangepasswordfirst_help', 'auth') ?></p>
268     </td>
269 </tr>
271 <tr valign="top"  class="required">
272     <td align="right" valign="top"><label for="menustdchangepassword"><?php print_string('stdchangepassword', 'auth') ?></label></td>
273     <td>
274         <?php echo $OUTPUT->select(html_select::make($yesno, 'stdchangepassword', $config->stdchangepassword, false)); ?>
275     </td>
276     <td align="left" valign="top">
277         <p><?php print_string('stdchangepassword_expl', 'auth') ?></p>
278         <p><?php print_string('stdchangepassword_explldap', 'auth') ?></p>
279     </td>
280 </tr>
282 <tr valign="top" class="required">
283     <td align="right"><label for="menupasstype"><?php print_string('auth_ldap_passtype_key', 'auth_ldap') ?></label></td>
284     <td>
285         <?php
286         $passtype = array();
287         $passtype['plaintext'] = get_string('plaintext', 'auth');
288         $passtype['md5']       = get_string('md5', 'auth');
289         $passtype['sha1']      = get_string('sha1', 'auth');
290         echo $OUTPUT->select(html_select::make($passtype, 'passtype', $config->passtype, false));
292         ?>
293     </td>
294     <td><?php print_string('auth_ldap_passtype', 'auth_ldap') ?></td>
295 </tr>
297 <tr valign="top">
298     <td align="right"><label for="changepasswordurl"><?php print_string('auth_ldap_changepasswordurl_key','auth_ldap') ?></label></td>
299     <td>
300         <input name="changepasswordurl" id="changepasswordurl" type="text" value="<?php echo $config->changepasswordurl ?>" />
301         <?php
303         if (isset($err['changepasswordurl'])) {
304             echo $OUTPUT->error_text($err['changepasswordurl']);
305         }
307         ?>
308     </td>
309     <td><?php print_string('changepasswordhelp', 'auth') ?></td>
310 </tr>
312 <tr>
313    <td colspan="2">
314         <h4><?php print_string('auth_ldap_passwdexpire_settings', 'auth_ldap') ?> </h4>
315    </td>
316 </tr>
318 <tr valign="top" class="required">
319     <td align="right"><label for="menuexpiration"><?php print_string('auth_ldap_expiration_key','auth_ldap') ?></label></td>
320     <td>
321     <?php
322        $expiration = array();
323        $expiration['0'] = 'no';
324        $expiration['1'] = 'LDAP';
325        echo $OUTPUT->select(html_select::make($expiration, 'expiration', $config->expiration, false));
326        if (isset($err['expiration'])) echo $OUTPUT->error_text($err['expiration']);
327     ?>
328     </td>
329     <td>
330     <?php print_string('auth_ldap_expiration_desc','auth_ldap') ?>
331     </td>
332 </tr>
335 <tr valign="top" class="required">
336     <td align="right"><label for="expiration_warning"><?php print_string('auth_ldap_expiration_warning_key','auth_ldap') ?></label></td>
337     <td>
338     <input name="expiration_warning" id="expiration_warning" type="text" size="2" value="<?php echo $config->expiration_warning?>" />
339     <?php   if (isset($err['expiration_warning'])) echo $OUTPUT->error_text($err['expiration_warning']);
340     ?>
341     </td>
342     <td>
343     <?php print_string('auth_ldap_expiration_warning_desc','auth_ldap') ?>
344     </td>
345 </tr>
347 <tr valign="top" class="required">
348     <td align="right"><label for="expireattr"><?php print_string('auth_ldap_expireattr_key','auth_ldap') ?></label></td>
349     <td>
350     <input name="expireattr" id="expireattr" type="text" size="30" value="<?php echo $config->expireattr?>" />
351     <?php  if (isset($err['expireattr'])) echo $OUTPUT->error_text($err['expireattr']);
352     ?>
353     </td>
354     <td>
355     <?php print_string('auth_ldap_expireattr_desc','auth_ldap') ?>
356     </td>
357 </tr>
359 <tr valign="top" class="required">
360     <td align="right"><label for="menugracelogins"><?php print_string('auth_ldap_gracelogins_key','auth_ldap') ?></label></td>
361     <td>
362         <?php echo $OUTPUT->select(html_select::make($yesno, 'gracelogins', $config->gracelogins, false)); ?>
363     </td>
364     <td>
365     <?php print_string('auth_ldap_gracelogins_desc','auth_ldap') ?>
366     </td>
367 </tr>
369 <tr valign="top" class="required">
370     <td align="right"><label for="graceattr"><?php print_string('auth_ldap_gracelogin_key','auth_ldap') ?></label></td>
371     <td>
372     <input name="graceattr" id="graceattr" type="text" size="30" value="<?php echo $config->graceattr?>" />
373     <?php   if (isset($err['graceattr'])) echo $OUTPUT->error_text($err['graceattr']);
374     ?>
375     </td>
376     <td>
377     <?php print_string('auth_ldap_graceattr_desc','auth_ldap') ?>
378     </td>
379 </tr>
383 <tr>
384    <td colspan="2">
385         <h4><?php print_string('auth_user_create', 'auth') ?> </h4>
386    </td>
387 </tr>
389 <tr valign="top">
390     <td align="right"><label for="menuauth_user_create"><?php print_string('auth_ldap_auth_user_create_key','auth_ldap') ?></label></td>
391     <td>
392       <?php echo $OUTPUT->select(html_select::make($yesno, 'auth_user_create', $config->auth_user_create, false)); ?>
393     </td>
394     <td>
395         <?php print_string("auth_user_creation","auth"); ?>
396     </td>
397 </tr>
399 <tr valign="top" class="required">
400     <td align="right"><label for="create_context"><?php print_string('auth_ldap_create_context_key','auth_ldap') ?></label></td>
401     <td>
402     <input name="create_context" id="create_context" type="text" size="30" value="<?php echo $config->create_context?>" />
403     <?php  if (isset($err['create_context'])) echo $OUTPUT->error_text($err['create_context']); ?>
404     </td><td>
405     <?php print_string('auth_ldap_create_context','auth_ldap') ?>
406     </td>
407 </tr>
410 <tr>
411    <td colspan="2">
412         <h4><?php print_string('coursecreators') ?> </h4>
413    </td>
414 </tr>
416 <tr valign="top" class="required">
417         <td align="right"><label for="creators"><?php print_string('auth_ldap_creators_key','auth_ldap') ?></label></td>
418         <td>
419     <input name="creators" id="creators" type="text" size="30" value="<?php echo $config->creators?>" />
420     <?php  if (isset($err['creators'])) echo $OUTPUT->error_text($err['creators']); ?>
421     </td><td>
422     <?php print_string('auth_ldap_creators','auth_ldap') ?>
423     </td>
424 </tr>
426 <tr>
427    <td colspan="2">
428         <h4><?php print_string('auth_sync_script', 'auth') ?> </h4>
429    </td>
430 </tr>
432 <tr valign="top">
433     <td align="right"><label for="menuremoveuser"><?php print_string('auth_remove_user_key','auth') ?></label></td>
434     <td>
435     <?php
436        $deleteopt = array();
437        $deleteopt[AUTH_REMOVEUSER_KEEP] = get_string('auth_remove_keep','auth');
438        $deleteopt[AUTH_REMOVEUSER_SUSPEND] = get_string('auth_remove_suspend','auth');
439        $deleteopt[AUTH_REMOVEUSER_FULLDELETE] = get_string('auth_remove_delete','auth');
440        echo $OUTPUT->select(html_select::make($deleteopt, 'removeuser', $config->removeuser, false));
441     ?>
442     </td>
443     <td>
444     <?php print_string('auth_remove_user','auth') ?>
445     </td>
446 </tr>
448 <tr>
449    <td colspan="2">
450         <h4><?php print_string('auth_ntlmsso', '_ldap') ?> </h4>
451    </td>
452 </tr>
454 <tr valign="top">
455     <td align="right"><label for="menuntlmsso_enabled"><?php print_string('auth_ntlmsso_enabled_key','auth_ldap') ?></label></td>
456     <td>
457     <?php
458        echo $OUTPUT->select(html_select::make($yesno, 'ntlmsso_enabled', $config->ntlmsso_enabled));
459     ?>
460     </td>
461     <td>
462     <?php print_string('auth_ntlmsso_enabled','auth_ldap') ?>
463     </td>
464 </tr>
465 <tr valign="top">
466     <td align="right"><label for="ntlmsso_subnet"><?php print_string('auth_ntlmsso_subnet_key','auth_ldap') ?></label></td>
467     <td><input name="ntlmsso_subnet" id="ntlmsso_subnet" type="text" size="30" value="<?php p($config->ntlmsso_subnet) ?>" />
468     </td>
469     <td>
470     <?php print_string('auth_ntlmsso_subnet','auth_ldap') ?>
471     </td>
472 </tr>
473 <tr valign="top">
474     <td align="right"><label for="menuntlmsso_ie_fastpath"><?php print_string('auth_ntlmsso_ie_fastpath_key','auth_ldap') ?></label></td>
475     <td>
476     <?php
477        echo $OUTPUT->select(html_select::make($yesno, 'ntlmsso_ie_fastpath', $config->ntlmsso_ie_fastpath));
478     ?>
479     </td>
480     <td>
481     <?php print_string('auth_ntlmsso_ie_fastpath','auth_ldap') ?>
482     </td>
483 </tr>
485 <?php
487 $help  = get_string('auth_ldapextrafields','auth_ldap');
488 $help .= get_string('auth_updatelocal_expl','auth');
489 $help .= get_string('auth_fieldlock_expl','auth');
490 $help .= get_string('auth_updateremote_expl','auth');
491 $help .= '<hr />';
492 $help .= get_string('auth_updateremote_ldap','auth');
494 print_auth_lock_options('ldap', $user_fields, $help, true, true);
496 ?>
498 </table>