394c5188a39df1941dd87ecf9d8378feb8de2665
[moodle.git] / auth / cas / config.html
1 <?php
3 include($CFG->dirroot.'/auth/cas/languages.php');
5 // set to defaults if undefined (CAS)
6 if (!isset ($config->hostname)) {
7     $config->hostname = '';
8 }
9 if (!isset ($config->port)) {
10     $config->port = '';
11 }
12 if (!isset ($config->casversion)) {
13     $config->casversion = CAS_VERSION_2_0;
14 }
15 if (!isset ($config->baseuri)) {
16     $config->baseuri = '';
17 }
18 if (!isset ($config->language)) {
19     $config->language = '';
20 }
21 if (!isset ($config->proxycas)) {
22     $config->proxycas = '';
23 }
24 if (!isset ($config->logoutcas)) {
25     $config->logoutcas = '';
26 }
27 if (!isset ($config->multiauth)) {
28     $config->multiauth = '';
29 }
30 if (!isset ($config->certificate_check)) {
31     $config->certificate_check = '';
32 }
33 if (!isset ($config->certificate_path)) {
34     $config->certificate_path = '';
35 }
36 if (!isset($config->curl_ssl_version)) {
37     $config->curl_ssl_version = '';
38 }
39 if (!isset($config->logout_return_url)) {
40     $config->logout_return_url = '';
41 }
43 // set to defaults if undefined (LDAP)
44 if (!isset($config->host_url)) {
45      $config->host_url = '';
46 }
47 if (!isset($config->start_tls)) {
48     $config->start_tls = false;
49 }
50 if (empty($config->ldapencoding)) {
51     $config->ldapencoding = 'utf-8';
52 }
53 if (!isset($config->pagesize)) {
54     $config->pagesize = LDAP_DEFAULT_PAGESIZE;
55 }
56 if (!isset($config->contexts)) {
57     $config->contexts = '';
58 }
59 if (!isset($config->user_type)) {
60     $config->user_type = 'default';
61 }
62 if (!isset($config->user_attribute)) {
63     $config->user_attribute = '';
64 }
65 if (!isset($config->search_sub)) {
66     $config->search_sub = '';
67 }
68 if (!isset($config->opt_deref)) {
69     $config->opt_deref = LDAP_DEREF_NEVER;
70 }
71 if (!isset($config->bind_dn)) {
72     $config->bind_dn = '';
73 }
74 if (!isset($config->bind_pw)) {
75     $config->bind_pw = '';
76 }
77 if (!isset($config->ldap_version)) {
78     $config->ldap_version = '3';
79 }
80 if (!isset($config->objectclass)) {
81     $config->objectclass = '';
82 }
83 if (!isset($config->memberattribute)) {
84     $config->memberattribute = '';
85 }
86 if (!isset($config->memberattribute_isdn)) {
87     $config->memberattribute_isdn = '';
88 }
89 if (!isset($config->groupecreators)) {
90     $config->groupecreators = '';
91 }
92 if (!isset($config->attrcreators)) {
93     $config->attrcreators = '';
94 }
95 if (!isset($config->removeuser)) {
96     $config->removeuser = AUTH_REMOVEUSER_KEEP;
97 }
99 $yesno = array( get_string('no'), get_string('yes') );
101 $disabled = '';
102 if (!ldap_paged_results_supported($config->ldap_version)) {
103     $disabled = ' disabled="disabled"';
104     echo $OUTPUT->notification(get_string('pagedresultsnotsupp', 'auth_ldap'));
107 ?>
108 <table cellspacing="0" cellpadding="5" border="0">
109 <tr>
110     <td colspan="2">
111         <h4><?php print_string('auth_cas_server_settings', 'auth_cas') ?></h4>
112     </td>
113 </tr>
114 <tr valign="top" class="required">
115     <td align="right"><label for="hostname"><?php print_string('auth_cas_hostname_key', 'auth_cas') ?>: </label></td>
116     <td>
117         <input name="hostname" id="hostname" type="text" size="30" value="<?php echo $config->hostname ?>" />
118         <?php if (isset($err['hostname'])) { echo $OUTPUT->error_text($err['hostname']); } ?>
119     </td>
120     <td>
121         <?php print_string('auth_cas_hostname', 'auth_cas') ?>
122     </td>
123 </tr>
124 <tr valign="top" class="required">
125     <td align="right">
126         <label for="baseuri"><?php print_string('auth_cas_baseuri_key', 'auth_cas') ?>: </label>
127     </td>
128     <td>
129         <input name="baseuri" id="baseuri" type="text" size="30" value="<?php echo $config->baseuri ?>" />
130         <?php if (isset($err['baseuri'])) { echo $OUTPUT->error_text($err['baseuri']); } ?>
131     </td>
132     <td>
133         <?php print_string('auth_cas_baseuri', 'auth_cas') ?>
134     </td>
135 </tr>
136 <tr valign="top" class="required">
137     <td align="right">
138         <label for="port"><?php print_string('auth_cas_port_key', 'auth_cas') ?>: </label>
139     </td>
140     <td>
141         <input name="port" id="port" type="text" size="30" value="<?php echo $config->port ?>" />
142         <?php if (isset($err['port'])) { echo $OUTPUT->error_text($err['port']); } ?>
143     </td>
144     <td>
145         <?php print_string('auth_cas_port', 'auth_cas') ?>
146     </td>
147 </tr>
148 <tr valign="top" class="required">
149     <td align="right">
150         <?php echo html_writer::label(get_string('auth_cas_casversion', 'auth_cas'), 'menucasversion'); ?>:
151     </td>
152     <td>
153         <?php
154              $casversions = array();
155              $casversions[CAS_VERSION_1_0] = 'CAS 1.0';
156              $casversions[CAS_VERSION_2_0] = 'CAS 2.0';
157              echo html_writer::select($casversions, 'casversion', $config->casversion, false);
158              if (isset($err['casversion'])) { echo $OUTPUT->error_text($err['casversion']); }
159         ?>
160     </td>
161     <td>
162         <?php print_string('auth_cas_version', 'auth_cas') ?>
163     </td>
164 </tr>
165 <tr valign="top" class="required">
166     <td align="right"><?php echo html_writer::label(get_string('auth_cas_language_key', 'auth_cas'), 'menulanguage'); ?>:</td>
167     <td>
168         <?php echo html_writer::select($CASLANGUAGES, 'language', $config->language, false); ?>
169     </td>
170     <td>
171         <?php print_string('auth_cas_language', 'auth_cas') ?>
172     </td>
173 </tr>
174 <tr valign="top" class="required">
175     <td align="right">
176         <?php echo html_writer::label(get_string('auth_cas_proxycas_key', 'auth_cas'), 'menuproxycas'); ?>:
177     </td>
178     <td>
179         <?php echo html_writer::select($yesno, 'proxycas', $config->proxycas, false); ?>
180     </td>
181     <td>
182         <?php print_string('auth_cas_proxycas', 'auth_cas') ?>
183     </td>
184 </tr>
185 <tr valign="top" class="required">
186     <td align="right"><?php echo html_writer::label(get_string('auth_cas_logoutcas_key', 'auth_cas'), 'menulogoutcas'); ?>:</td>
187     <td>
188         <?php echo html_writer::select($yesno, 'logoutcas', $config->logoutcas, false); ?>
189     </td>
190     <td>
191         <?php print_string('auth_cas_logoutcas', 'auth_cas') ?>
192     </td>
193 </tr>
194 <tr valign="top" class="required">
195     <td align="right"><?php echo html_writer::label(get_string('auth_cas_multiauth_key', 'auth_cas'), 'menumultiauth'); ?>:</td>
196     <td>
197         <?php echo html_writer::select($yesno, 'multiauth', $config->multiauth, false); ?>
198     </td>
199     <td>
200         <?php print_string('auth_cas_multiauth', 'auth_cas') ?>
201     </td>
202 </tr>
203 <tr valign="top"  class="required">
204     <td align="right"><?php echo html_writer::label(get_string('auth_cas_certificate_check_key', 'auth_cas'), 'menucertificate_check'); ?>:</td>
205     <td>
206         <?php echo html_writer::select($yesno, 'certificate_check', $config->certificate_check, false); ?>
207     </td>
208     <td>
209         <?php print_string('auth_cas_certificate_check', 'auth_cas') ?>
210     </td>
211 </tr>
212 <tr valign="top" class="required">
213     <td align="right"><label for="certificate_path"><?php print_string('auth_cas_certificate_path_key', 'auth_cas') ?>: </label></td>
214     <td>
215         <input name="certificate_path" id="certificate_path" type="text" size="30" value="<?php echo $config->certificate_path ?>" />
216         <?php if (isset($err['certificate_path'])) echo $OUTPUT->error_text($err['certificate_path']); ?>
217     </td>
218     <td>
219         <?php print_string('auth_cas_certificate_path', 'auth_cas') ?>
220     </td>
221 </tr>
222 <tr valign="top" class="required">
223     <td align="right"><label for="curl_ssl_version"><?php print_string('auth_cas_curl_ssl_version_key', 'auth_cas') ?>: </label></td>
224     <td>
225         <input name="curl_ssl_version" id="curl_ssl_version" type="text" size="3" value="<?php echo $config->curl_ssl_version ?>" />
226         <?php if (isset($err['curl_ssl_version'])) echo $OUTPUT->error_text($err['curl_ssl_version']); ?>
227     </td>
228     <td>
229         <?php print_string('auth_cas_curl_ssl_version', 'auth_cas') ?>
230     </td>
231 </tr>
232 <tr valign="top" class="required">
233     <td align="right"><?php print_string('auth_cas_logout_return_url_key', 'auth_cas') ?>:</td>
234     <td>
235        <input name="logout_return_url" type="text" size="30" value="<?php echo $config->logout_return_url ?>" />
236        <?php if (isset($err['logout_return_url'])) { echo $OUTPUT->error_text($err['logout_return_url']); } ?>
237     </td>
238     <td>
239         <?php print_string('auth_cas_logout_return_url', 'auth_cas') ?>
240     </td>
241 </tr>
242 <tr>
243    <td colspan="2">
244         <h4><?php print_string('auth_ldap_server_settings', 'auth_ldap') ?></h4>
245    </td>
246 </tr>
247 <tr valign="top" class="required">
248     <td align="right">
249         <label for="host_url"><?php print_string('auth_ldap_host_url_key', 'auth_ldap') ?></label>
250     </td>
251     <td>
252         <input name="host_url" id="host_url" type="text" size="30" value="<?php echo $config->host_url?>" />
253         <?php if (isset($err['host_url'])) { echo $OUTPUT->error_text($err['host_url']); } ?>
254     </td>
255     <td>
256         <?php print_string('auth_ldap_host_url', 'auth_ldap') ?>
257     </td>
258 </tr>
259 <tr valign="top" class="required">
260     <td align="right"><label for="ldap_version"><?php print_string('auth_ldap_version_key', 'auth_ldap') ?></label></td>
261     <td>
262         <?php
263              $versions = array();
264              $versions[2] = '2';
265              $versions[3] = '3';
266              echo html_writer::select($versions, 'ldap_version', $config->ldap_version, false);
267              if (isset($err['ldap_version'])) { echo $OUTPUT->error_text($err['ldap_version']); }
268         ?>
269     </td>
270     <td>
271         <?php print_string('auth_ldap_version', 'auth_ldap') ?>
272     </td>
273 </tr>
274 <tr valign="top">
275     <td align="right">
276         <label for="start_tls"><?php print_string('start_tls_key', 'auth_ldap') ?></label>
277     </td>
278     <td>
279         <?php echo html_writer::select($yesno, 'start_tls', $config->start_tls, false); ?>
280     </td>
281     <td>
282         <?php print_string('start_tls', 'auth_ldap') ?>
283     </td>
284 </tr>
285 <tr valign="top" class="required">
286     <td align="right">
287         <label for="ldapencoding"><?php print_string('auth_ldap_ldap_encoding_key', 'auth_ldap') ?></label>
288     </td>
289     <td>
290         <input id="ldapencoding" name="ldapencoding" type="text" value="<?php echo $config->ldapencoding ?>" />
291         <?php if (isset($err['ldapencoding'])) { echo $OUTPUT->error_text($err['ldapencoding']); } ?>
292     </td>
293     <td>
294         <?php print_string('auth_ldap_ldap_encoding', 'auth_ldap') ?>
295     </td>
296 </tr>
297 <tr valign="top">
298     <td align="right">
299         <label for="pagesize"><?php print_string('pagesize_key', 'auth_ldap') ?></label>
300     </td>
301     <td>
302         <input id="pagesize" name="pagesize" type="text" value="<?php echo $config->pagesize ?>" <?php echo $disabled ?>/>
303         <?php
304             if (isset($err['pagesize'])) { echo $OUTPUT->error_text($err['pagesize']); }
305             if ($disabled) {
306                 // Don't loose the page size value (disabled fields are not submitted!)
307         ?>
308             <input id="pagesize" name="pagesize" type="hidden" value="<?php echo $config->pagesize ?>" />
309         <?php } ?>
310     </td>
311     <td>
312         <?php print_string('pagesize', 'auth_ldap') ?>
313     </td>
314 </tr>
315 <tr>
316     <td colspan="2">
317         <h4><?php print_string('auth_ldap_bind_settings', 'auth_ldap') ?></h4>
318     </td>
319 </tr>
320 <tr valign="top" class="required">
321     <td align="right">
322         <label for="bind_dn"><?php print_string('auth_ldap_bind_dn_key', 'auth_ldap') ?></label>
323     </td>
324     <td>
325         <input name="bind_dn" id="bind_dn" type="text" size="30" value="<?php echo $config->bind_dn?>" />
326         <?php if (isset($err['bind_dn'])) { echo $OUTPUT->error_text($err['bind_dn']); } ?>
327     </td>
328     <td>
329         <?php print_string('auth_ldap_bind_dn', 'auth_ldap') ?>
330     </td>
331 </tr>
332 <tr valign="top" class="required">
333     <td align="right">
334         <label for="bind_pw"><?php print_string('auth_ldap_bind_pw_key', 'auth_ldap') ?></label>
335     </td>
336     <td>
337         <input name="bind_pw" id="bind_pw" type="password" size="30" value="<?php echo $config->bind_pw?>" autocomplete="off"/>
338         <?php if (isset($err['bind_pw'])) { echo $OUTPUT->error_text($err['bind_pw']); } ?>
339     </td>
340     <td>
341         <?php print_string('auth_ldap_bind_pw', 'auth_ldap') ?>
342     </td>
343 </tr>
344 <tr>
345     <td colspan="2">
346         <h4><?php print_string('auth_ldap_user_settings', 'auth_ldap') ?></h4>
347     </td>
348 </tr>
349 <tr valign="top" class="required">
350     <td align="right">
351         <label for="menuuser_type"><?php print_string('auth_ldap_user_type_key', 'auth_ldap') ?></label>
352     </td>
353     <td>
354         <?php
355             echo html_writer::select(ldap_supported_usertypes(), 'user_type', $config->user_type, false);
356             if (isset($err['user_type'])) { echo $OUTPUT->error_text($err['user_type']); }
357         ?>
358     </td>
359     <td>
360         <?php print_string('auth_ldap_user_type', 'auth_ldap') ?>
361     </td>
362 </tr>
363 <tr valign="top" class="required">
364     <td align="right">
365         <label for="contexts"><?php print_string('auth_ldap_contexts_key', 'auth_ldap') ?></label>
366     </td>
367     <td>
368         <input name="contexts" id="contexts" type="text" size="30" value="<?php echo $config->contexts?>" />
369         <?php if (isset($err['contexts'])) { echo $OUTPUT->error_text($err['contexts']); } ?>
370     </td>
371     <td>
372         <?php print_string('auth_ldap_contexts', 'auth_ldap') ?>
373     </td>
374 </tr>
375 <tr valign="top" class="required">
376     <td align="right">
377         <label for="menusearch_sub"><?php print_string('auth_ldap_search_sub_key', 'auth_ldap') ?></label></td>
378     <td>
379         <?php echo html_writer::select($yesno, 'search_sub', $config->search_sub, false); ?>
380     </td>
381     <td>
382         <?php print_string('auth_ldap_search_sub', 'auth_ldap') ?>
383     </td>
384 </tr>
385 <tr valign="top" class="required">
386     <td align="right"><label for="menuopt_deref"><?php print_string('auth_ldap_opt_deref_key', 'auth_ldap') ?></label></td>
387     <td>
388         <?php
389              $opt_deref = array();
390              $opt_deref[LDAP_DEREF_NEVER] = get_string('no');
391              $opt_deref[LDAP_DEREF_ALWAYS] = get_string('yes');
392              echo html_writer::select($opt_deref, 'opt_deref', $config->opt_deref, false);
393              if (isset($err['opt_deref'])) { echo $OUTPUT->error_text($err['opt_deref']); }
394         ?>
395     </td>
396     <td>
397         <?php print_string('auth_ldap_opt_deref', 'auth_ldap') ?>
398     </td>
399 </tr>
400 <tr valign="top" class="required">
401     <td align="right">
402         <label for="user_attribute"><?php print_string('auth_ldap_user_attribute_key', 'auth_ldap') ?></label>
403     </td>
404     <td>
405         <input name="user_attribute" id="user_attribute" type="text" size="30" value="<?php echo $config->user_attribute?>" />
406         <?php if (isset($err['user_attribute'])) { echo $OUTPUT->error_text($err['user_attribute']); } ?>
407     </td>
408     <td>
409         <?php print_string('auth_ldap_user_attribute', 'auth_ldap') ?>
410     </td>
411 </tr>
412 <tr valign="top" class="required">
413     <td align="right">
414         <label for="memberattribute"><?php print_string('auth_ldap_memberattribute_key', 'auth_ldap') ?></label>
415     </td>
416     <td>
417         <input name="memberattribute" id="memberattribute" type="text" size="30" value="<?php echo $config->memberattribute?>" />
418         <?php if (isset($err['memberattribute'])) { echo $OUTPUT->error_text($err['memberattribute']); } ?>
419     </td>
420     <td>
421         <?php print_string('auth_ldap_memberattribute', 'auth_ldap') ?>
422     </td>
423 </tr>
424 <tr valign="top" class="required">
425     <td align="right">
426         <label for="memberattribute_isdn"><?php print_string('auth_ldap_memberattribute_isdn_key', 'auth_ldap') ?></label>
427     </td>
428     <td>
429         <input name="memberattribute_isdn" id="memberattribute_isdn" type="text" size="30" value="<?php echo $config->memberattribute_isdn?>" />
430         <?php if (isset($err['memberattribute_isdn'])) { echo $OUTPUT->error_text($err['memberattribute_isdn']); } ?>
431     </td>
432     <td>
433         <?php print_string('auth_ldap_memberattribute_isdn', 'auth_ldap') ?>
434     </td>
435 </tr>
436 <tr valign="top" class="required">
437     <td align="right">
438         <label for="objectclass"><?php print_string('auth_ldap_objectclass_key', 'auth_ldap') ?></label>
439     </td>
440     <td>
441         <input name="objectclass" id="objectclass" type="text" size="30" value="<?php echo $config->objectclass?>" />
442         <?php if (isset($err['objectclass'])) { echo $OUTPUT->error_text($err['objectclass']); } ?>
443     </td>
444     <td>
445         <?php print_string('auth_ldap_objectclass', 'auth_ldap') ?>
446     </td>
447 </tr>
448 <tr>
449     <td colspan="2">
450         <h4><?php print_string('coursecreators') ?></h4>
451     </td>
452 </tr>
453 <tr valign="top" class="required">
454     <td align="right">
455         <label for="attrcreators"><?php print_string('auth_ldap_attrcreators_key', 'auth_ldap') ?></label>
456     </td>
457     <td>
458         <input name="attrcreators" id="attrcreators" type="text" size="30" value="<?php echo $config->attrcreators?>" />
459         <?php if (isset($err['attrcreators'])) { echo $OUTPUT->error_text($err['attrcreators']); } ?>
460     </td>
461     <td>
462         <?php print_string('auth_ldap_attrcreators', 'auth_ldap') ?>
463     </td>
464 </tr>
465 <tr valign="top" class="required">
466     <td align="right">
467         <label for="groupecreators"><?php print_string('auth_ldap_groupecreators_key', 'auth_ldap') ?></label>
468     </td>
469     <td>
470         <input name="groupecreators" id="groupecreators" type="text" size="30" value="<?php echo $config->groupecreators?>" />
471         <?php if (isset($err['groupecreators'])) { echo $OUTPUT->error_text($err['groupecreators']); } ?>
472     </td>
473     <td>
474         <?php print_string('auth_ldap_groupecreators', 'auth_ldap') ?>
475     </td>
476 </tr>
477 <tr>
478     <td colspan="2">
479         <h4><?php print_string('auth_sync_script', 'auth') ?></h4>
480     </td>
481 </tr>
482 <tr valign="top">
483     <td align="right">
484         <label for="menuremoveuser"><?php print_string('auth_remove_user_key', 'auth') ?></label>
485     </td>
486     <td>
487         <?php
488              $deleteopt = array();
489              $deleteopt[AUTH_REMOVEUSER_KEEP] = get_string('auth_remove_keep', 'auth');
490              $deleteopt[AUTH_REMOVEUSER_SUSPEND] = get_string('auth_remove_suspend', 'auth');
491              $deleteopt[AUTH_REMOVEUSER_FULLDELETE] = get_string('auth_remove_delete', 'auth');
492              echo html_writer::select($deleteopt, 'removeuser', $config->removeuser, false);
493         ?>
494     </td>
495     <td>
496         <?php print_string('auth_remove_user', 'auth') ?>
497     </td>
498 </tr>
499 <?php
500 $help  = get_string('auth_ldapextrafields', 'auth_ldap');
501 $help .= get_string('auth_updatelocal_expl', 'auth');
502 $help .= get_string('auth_fieldlock_expl', 'auth');
503 $help .= get_string('auth_updateremote_expl', 'auth');
504 $help .= '<hr />';
505 $help .= get_string('auth_updateremote_ldap', 'auth');
507 print_auth_lock_options($this->authtype, $user_fields, $help, true, true, $this->get_custom_user_profile_fields());
508 ?>
509 </table>