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)) {
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->curl_ssl_version)) {
37 $config->curl_ssl_version = '';
39 if (!isset($config->logout_return_url)) {
40 $config->logout_return_url = '';
43 // set to defaults if undefined (LDAP)
44 if (!isset($config->host_url)) {
45 $config->host_url = '';
47 if (!isset($config->start_tls)) {
48 $config->start_tls = false;
50 if (empty($config->ldapencoding)) {
51 $config->ldapencoding = 'utf-8';
53 if (!isset($config->pagesize)) {
54 $config->pagesize = LDAP_DEFAULT_PAGESIZE;
56 if (!isset($config->contexts)) {
57 $config->contexts = '';
59 if (!isset($config->user_type)) {
60 $config->user_type = 'default';
62 if (!isset($config->user_attribute)) {
63 $config->user_attribute = '';
65 if (!isset($config->search_sub)) {
66 $config->search_sub = '';
68 if (!isset($config->opt_deref)) {
69 $config->opt_deref = LDAP_DEREF_NEVER;
71 if (!isset($config->bind_dn)) {
72 $config->bind_dn = '';
74 if (!isset($config->bind_pw)) {
75 $config->bind_pw = '';
77 if (!isset($config->ldap_version)) {
78 $config->ldap_version = '3';
80 if (!isset($config->objectclass)) {
81 $config->objectclass = '';
83 if (!isset($config->memberattribute)) {
84 $config->memberattribute = '';
86 if (!isset($config->memberattribute_isdn)) {
87 $config->memberattribute_isdn = '';
89 if (!isset($config->groupecreators)) {
90 $config->groupecreators = '';
92 if (!isset($config->attrcreators)) {
93 $config->attrcreators = '';
95 if (!isset($config->removeuser)) {
96 $config->removeuser = AUTH_REMOVEUSER_KEEP;
99 $yesno = array( get_string('no'), get_string('yes') );
102 if (!ldap_paged_results_supported($config->ldap_version)) {
103 $disabled = ' disabled="disabled"';
104 echo $OUTPUT->notification(get_string('pagedresultsnotsupp', 'auth_ldap'));
108 <table cellspacing="0" cellpadding="5" border="0">
111 <h4><?php print_string('auth_cas_server_settings', 'auth_cas') ?></h4>
114 <tr valign="top" class="required">
115 <td align="right"><label for="hostname"><?php print_string('auth_cas_hostname_key', 'auth_cas') ?>: </label></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']); } ?>
121 <?php print_string('auth_cas_hostname', 'auth_cas') ?>
124 <tr valign="top" class="required">
126 <label for="baseuri"><?php print_string('auth_cas_baseuri_key', 'auth_cas') ?>: </label>
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']); } ?>
133 <?php print_string('auth_cas_baseuri', 'auth_cas') ?>
136 <tr valign="top" class="required">
138 <label for="port"><?php print_string('auth_cas_port_key', 'auth_cas') ?>: </label>
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']); } ?>
145 <?php print_string('auth_cas_port', 'auth_cas') ?>
148 <tr valign="top" class="required">
150 <?php echo html_writer::label(get_string('auth_cas_casversion', 'auth_cas'), 'menucasversion'); ?>:
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']); }
162 <?php print_string('auth_cas_version', 'auth_cas') ?>
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>
168 <?php echo html_writer::select($CASLANGUAGES, 'language', $config->language, false); ?>
171 <?php print_string('auth_cas_language', 'auth_cas') ?>
174 <tr valign="top" class="required">
176 <?php echo html_writer::label(get_string('auth_cas_proxycas_key', 'auth_cas'), 'menuproxycas'); ?>:
179 <?php echo html_writer::select($yesno, 'proxycas', $config->proxycas, false); ?>
182 <?php print_string('auth_cas_proxycas', 'auth_cas') ?>
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>
188 <?php echo html_writer::select($yesno, 'logoutcas', $config->logoutcas, false); ?>
191 <?php print_string('auth_cas_logoutcas', 'auth_cas') ?>
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>
197 <?php echo html_writer::select($yesno, 'multiauth', $config->multiauth, false); ?>
200 <?php print_string('auth_cas_multiauth', 'auth_cas') ?>
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>
206 <?php echo html_writer::select($yesno, 'certificate_check', $config->certificate_check, false); ?>
209 <?php print_string('auth_cas_certificate_check', 'auth_cas') ?>
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>
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']); ?>
219 <?php print_string('auth_cas_certificate_path', 'auth_cas') ?>
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>
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']); ?>
229 <?php print_string('auth_cas_curl_ssl_version', 'auth_cas') ?>
232 <tr valign="top" class="required">
233 <td align="right"><?php print_string('auth_cas_logout_return_url_key', 'auth_cas') ?>:</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']); } ?>
239 <?php print_string('auth_cas_logout_return_url', 'auth_cas') ?>
244 <h4><?php print_string('auth_ldap_server_settings', 'auth_ldap') ?></h4>
247 <tr valign="top" class="required">
249 <label for="host_url"><?php print_string('auth_ldap_host_url_key', 'auth_ldap') ?></label>
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']); } ?>
256 <?php print_string('auth_ldap_host_url', 'auth_ldap') ?>
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>
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']); }
271 <?php print_string('auth_ldap_version', 'auth_ldap') ?>
276 <label for="start_tls"><?php print_string('start_tls_key', 'auth_ldap') ?></label>
279 <?php echo html_writer::select($yesno, 'start_tls', $config->start_tls, false); ?>
282 <?php print_string('start_tls', 'auth_ldap') ?>
285 <tr valign="top" class="required">
287 <label for="ldapencoding"><?php print_string('auth_ldap_ldap_encoding_key', 'auth_ldap') ?></label>
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']); } ?>
294 <?php print_string('auth_ldap_ldap_encoding', 'auth_ldap') ?>
299 <label for="pagesize"><?php print_string('pagesize_key', 'auth_ldap') ?></label>
302 <input id="pagesize" name="pagesize" type="text" value="<?php echo $config->pagesize ?>" <?php echo $disabled ?>/>
304 if (isset($err['pagesize'])) { echo $OUTPUT->error_text($err['pagesize']); }
306 // Don't loose the page size value (disabled fields are not submitted!)
308 <input id="pagesize" name="pagesize" type="hidden" value="<?php echo $config->pagesize ?>" />
312 <?php print_string('pagesize', 'auth_ldap') ?>
317 <h4><?php print_string('auth_ldap_bind_settings', 'auth_ldap') ?></h4>
320 <tr valign="top" class="required">
322 <label for="bind_dn"><?php print_string('auth_ldap_bind_dn_key', 'auth_ldap') ?></label>
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']); } ?>
329 <?php print_string('auth_ldap_bind_dn', 'auth_ldap') ?>
332 <tr valign="top" class="required">
334 <label for="bind_pw"><?php print_string('auth_ldap_bind_pw_key', 'auth_ldap') ?></label>
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']); } ?>
341 <?php print_string('auth_ldap_bind_pw', 'auth_ldap') ?>
346 <h4><?php print_string('auth_ldap_user_settings', 'auth_ldap') ?></h4>
349 <tr valign="top" class="required">
351 <label for="menuuser_type"><?php print_string('auth_ldap_user_type_key', 'auth_ldap') ?></label>
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']); }
360 <?php print_string('auth_ldap_user_type', 'auth_ldap') ?>
363 <tr valign="top" class="required">
365 <label for="contexts"><?php print_string('auth_ldap_contexts_key', 'auth_ldap') ?></label>
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']); } ?>
372 <?php print_string('auth_ldap_contexts', 'auth_ldap') ?>
375 <tr valign="top" class="required">
377 <label for="menusearch_sub"><?php print_string('auth_ldap_search_sub_key', 'auth_ldap') ?></label></td>
379 <?php echo html_writer::select($yesno, 'search_sub', $config->search_sub, false); ?>
382 <?php print_string('auth_ldap_search_sub', 'auth_ldap') ?>
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>
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']); }
397 <?php print_string('auth_ldap_opt_deref', 'auth_ldap') ?>
400 <tr valign="top" class="required">
402 <label for="user_attribute"><?php print_string('auth_ldap_user_attribute_key', 'auth_ldap') ?></label>
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']); } ?>
409 <?php print_string('auth_ldap_user_attribute', 'auth_ldap') ?>
412 <tr valign="top" class="required">
414 <label for="memberattribute"><?php print_string('auth_ldap_memberattribute_key', 'auth_ldap') ?></label>
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']); } ?>
421 <?php print_string('auth_ldap_memberattribute', 'auth_ldap') ?>
424 <tr valign="top" class="required">
426 <label for="memberattribute_isdn"><?php print_string('auth_ldap_memberattribute_isdn_key', 'auth_ldap') ?></label>
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']); } ?>
433 <?php print_string('auth_ldap_memberattribute_isdn', 'auth_ldap') ?>
436 <tr valign="top" class="required">
438 <label for="objectclass"><?php print_string('auth_ldap_objectclass_key', 'auth_ldap') ?></label>
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']); } ?>
445 <?php print_string('auth_ldap_objectclass', 'auth_ldap') ?>
450 <h4><?php print_string('coursecreators') ?></h4>
453 <tr valign="top" class="required">
455 <label for="attrcreators"><?php print_string('auth_ldap_attrcreators_key', 'auth_ldap') ?></label>
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']); } ?>
462 <?php print_string('auth_ldap_attrcreators', 'auth_ldap') ?>
465 <tr valign="top" class="required">
467 <label for="groupecreators"><?php print_string('auth_ldap_groupecreators_key', 'auth_ldap') ?></label>
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']); } ?>
474 <?php print_string('auth_ldap_groupecreators', 'auth_ldap') ?>
479 <h4><?php print_string('auth_sync_script', 'auth') ?></h4>
484 <label for="menuremoveuser"><?php print_string('auth_remove_user_key', 'auth') ?></label>
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);
496 <?php print_string('auth_remove_user', 'auth') ?>
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');
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());