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