3 // Set to defaults if undefined
4 if (!isset($config->host_url
)) {
5 $config->host_url
= '';
7 if (empty($config->ldapencoding
)) {
8 $config->ldapencoding
= 'utf-8';
10 if (!isset($config->contexts
)) {
11 $config->contexts
= '';
13 if (!isset($config->user_type
)) {
14 $config->user_type
= 'default';
16 if (!isset($config->user_attribute
)) {
17 $config->user_attribute
= '';
19 if (!isset($config->search_sub
)) {
20 $config->search_sub
= '';
22 if (!isset($config->opt_deref
)) {
23 $config->opt_deref
= LDAP_DEREF_NEVER
;
25 if (!isset($config->preventpassindb
)) {
26 $config->preventpassindb
= 0;
28 if (!isset($config->bind_dn
)) {
29 $config->bind_dn
= '';
31 if (!isset($config->bind_pw
)) {
32 $config->bind_pw
= '';
34 if (!isset($config->ldap_version
)) {
35 $config->ldap_version
= '3';
37 if (!isset($config->objectclass
)) {
38 $config->objectclass
= '';
40 if (!isset($config->memberattribute
)) {
41 $config->memberattribute
= '';
43 if (!isset($config->memberattribute_isdn
)) {
44 $config->memberattribute_isdn
= '';
46 if (!isset($config->creators
)) {
47 $config->creators
= '';
49 if (!isset($config->create_context
)) {
50 $config->create_context
= '';
52 if (!isset($config->expiration
)) {
53 $config->expiration
= '';
55 if (!isset($config->expiration_warning
)) {
56 $config->expiration_warning
= '10';
58 if (!isset($config->expireattr
)) {
59 $config->expireattr
= '';
61 if (!isset($config->gracelogins
)) {
62 $config->gracelogins
= '';
64 if (!isset($config->graceattr
)) {
65 $config->graceattr
= '';
67 if (!isset($config->auth_user_create
)) {
68 $config->auth_user_create
= '';
70 if (!isset($config->forcechangepassword
)) {
71 $config->forcechangepassword
= 0;
73 if (!isset($config->stdchangepassword
)) {
74 $config->stdchangepassword
= 0;
76 if (!isset($config->passtype
)) {
77 $config->passtype
= 'plaintext';
79 if (!isset($config->changepasswordurl
)) {
80 $config->changepasswordurl
= '';
82 if (!isset($config->removeuser
)) {
83 $config->removeuser
= AUTH_REMOVEUSER_KEEP
;
85 if (!isset($config->ntlmsso_enabled
)) {
86 $config->ntlmsso_enabled
= 0;
88 if (!isset($config->ntlmsso_subnet
)) {
89 $config->ntlmsso_subnet
= '';
91 if (!isset($config->ntlmsso_ie_fastpath
)) {
92 $config->ntlmsso_ie_fastpath
= 0;
94 if (!isset($config->ntlmsso_type
)) {
95 $config->ntlmsso_type
= 'ntlm';
98 $yesno = array(get_string('no'), get_string('yes'));
101 <table cellspacing=
"0" cellpadding=
"5" border=
"0">
104 <h4><?php print_string('auth_ldap_server_settings', 'auth_ldap') ?></h4>
107 <tr valign=
"top" class=
"required">
109 <label for=
"host_url"><?php print_string('auth_ldap_host_url_key', 'auth_ldap') ?></label>
112 <input name=
"host_url" id=
"host_url" type=
"text" size=
"30" value=
"<?php echo $config->host_url?>" />
113 <?php
if (isset($err['host_url'])) { echo $OUTPUT->error_text($err['host_url']); } ?>
116 <?php print_string('auth_ldap_host_url', 'auth_ldap') ?>
119 <tr valign=
"top" class=
"required">
121 <label for=
"menuldap_version"><?php print_string('auth_ldap_version_key', 'auth_ldap') ?></label>
128 echo html_writer
::select($versions, 'ldap_version', $config->ldap_version
, false);
129 if (isset($err['ldap_version'])) { echo $OUTPUT->error_text($err['ldap_version']); }
133 <?php print_string('auth_ldap_version', 'auth_ldap') ?>
136 <tr valign=
"top" class=
"required">
138 <label for=
"ldapencoding"><?php print_string('auth_ldap_ldap_encoding_key', 'auth_ldap') ?></label>
141 <input id=
"ldapencoding" name=
"ldapencoding" type=
"text" value=
"<?php echo $config->ldapencoding ?>" />
142 <?php
if (isset($err['ldapencoding'])) { echo $OUTPUT->error_text($err['ldapencoding']); } ?>
145 <?php print_string('auth_ldap_ldap_encoding', 'auth_ldap') ?>
150 <h4><?php print_string('auth_ldap_bind_settings', 'auth_ldap') ?></h4>
153 <tr valign=
"top" class=
"required">
155 <label for=
"menupreventpassindb"><?php print_string('auth_ldap_preventpassindb_key', 'auth_ldap') ?></label>
158 <?php echo html_writer
::select($yesno, 'preventpassindb', $config->preventpassindb
, false); ?>
161 <?php print_string('auth_ldap_preventpassindb', 'auth_ldap') ?>
164 <tr valign=
"top" class=
"required">
166 <label for=
"bind_dn"><?php print_string('auth_ldap_bind_dn_key', 'auth_ldap') ?></label>
169 <input name=
"bind_dn" id=
"bind_dn" type=
"text" size=
"30" value=
"<?php echo $config->bind_dn?>" />
170 <?php
if (isset($err['bind_dn'])) { echo $OUTPUT->error_text($err['bind_dn']); } ?>
173 <?php print_string('auth_ldap_bind_dn', 'auth_ldap') ?>
176 <tr valign=
"top" class=
"required">
178 <label for=
"bind_pw"><?php print_string('auth_ldap_bind_pw_key', 'auth_ldap') ?></label>
181 <input name=
"bind_pw" id=
"bind_pw" type=
"password" size=
"30" value=
"<?php echo $config->bind_pw?>" />
182 <?php
if (isset($err['bind_pw'])) { echo $OUTPUT->error_text($err['bind_pw']); } ?>
185 <?php print_string('auth_ldap_bind_pw', 'auth_ldap') ?>
190 <h4><?php print_string('auth_ldap_user_settings', 'auth_ldap') ?></h4>
193 <tr valign=
"top" class=
"required">
195 <label for=
"menuuser_type"><?php print_string('auth_ldap_user_type_key', 'auth_ldap') ?></label>
199 echo html_writer
::select(ldap_supported_usertypes(), 'user_type', $config->user_type
, false);
200 if (isset($err['user_type'])) { echo $OUTPUT->error_text($err['user_type']); }
204 <?php print_string('auth_ldap_user_type', 'auth_ldap') ?>
207 <tr valign=
"top" class=
"required">
209 <label for=
"contexts"><?php print_string('auth_ldap_contexts_key', 'auth_ldap') ?></label>
212 <input name=
"contexts" id=
"contexts" type=
"text" size=
"30" value=
"<?php echo $config->contexts?>" />
213 <?php
if (isset($err['contexts'])) { echo $OUTPUT->error_text($err['contexts']); } ?>
216 <?php print_string('auth_ldap_contexts', 'auth_ldap') ?>
219 <tr valign=
"top" class=
"required">
221 <label for=
"menusearch_sub"><?php print_string('auth_ldap_search_sub_key', 'auth_ldap') ?></label>
224 <?php echo html_writer
::select($yesno, 'search_sub', $config->search_sub
, false); ?>
227 <?php print_string('auth_ldap_search_sub', 'auth_ldap') ?>
230 <tr valign=
"top" class=
"required">
232 <label for=
"menuopt_deref"><?php print_string('auth_ldap_opt_deref_key', 'auth_ldap') ?></label>
236 $opt_deref = array();
237 $opt_deref[LDAP_DEREF_NEVER
] = get_string('no');
238 $opt_deref[LDAP_DEREF_ALWAYS
] = get_string('yes');
239 echo html_writer
::select($opt_deref, 'opt_deref', $config->opt_deref
, false);
240 if (isset($err['opt_deref'])) { echo $OUTPUT->error_text($err['opt_deref']); }
244 <?php print_string('auth_ldap_opt_deref', 'auth_ldap') ?>
247 <tr valign=
"top" class=
"required">
249 <label for=
"user_attribute"><?php print_string('auth_ldap_user_attribute_key', 'auth_ldap') ?></label>
252 <input name=
"user_attribute" id=
"user_attribute" type=
"text" size=
"30" value=
"<?php echo $config->user_attribute?>" />
253 <?php
if (isset($err['user_attribute'])) { echo $OUTPUT->error_text($err['user_attribute']); } ?>
256 <?php print_string('auth_ldap_user_attribute', 'auth_ldap') ?>
259 <tr valign=
"top" class=
"required">
261 <label for=
"memberattribute"><?php print_string('auth_ldap_memberattribute_key', 'auth_ldap') ?></label>
264 <input name=
"memberattribute" id=
"memberattribute" type=
"text" size=
"30" value=
"<?php echo $config->memberattribute?>" />
265 <?php
if (isset($err['memberattribute'])) { echo $OUTPUT->error_text($err['memberattribute']); } ?>
268 <?php print_string('auth_ldap_memberattribute', 'auth_ldap') ?>
271 <tr valign=
"top" class=
"required">
273 <label for=
"memberattribute_isdn"><?php print_string('auth_ldap_memberattribute_isdn_key', 'auth_ldap') ?></label>
276 <input name=
"memberattribute_isdn" id=
"memberattribute_isdn" type=
"text" size=
"30" value=
"<?php echo $config->memberattribute_isdn?>" />
277 <?php
if (isset($err['memberattribute_isdn'])) { echo $OUTPUT->error_text($err['memberattribute_isdn']); } ?>
280 <?php print_string('auth_ldap_memberattribute_isdn', 'auth_ldap') ?>
283 <tr valign=
"top" class=
"required">
285 <label for=
"objectclass"><?php print_string('auth_ldap_objectclass_key', 'auth_ldap') ?></label>
288 <input name=
"objectclass" id=
"objectclass" type=
"text" size=
"30" value=
"<?php echo $config->objectclass?>" />
289 <?php
if (isset($err['objectclass'])) { echo $OUTPUT->error_text($err['objectclass']); } ?>
292 <?php print_string('auth_ldap_objectclass', 'auth_ldap') ?>
297 <h4><?php print_string('forcechangepassword', 'auth') ?></h4>
300 <tr valign=
"top" class=
"required">
301 <td align=
"right" valign=
"top">
302 <label for=
"menuforcechangepassword"><?php print_string('forcechangepassword', 'auth') ?></label>
305 <?php echo html_writer
::select($yesno, 'forcechangepassword', $config->forcechangepassword
, false); ?>
307 <td align=
"left" valign=
"top">
308 <p><?php print_string('forcechangepasswordfirst_help', 'auth') ?></p>
311 <tr valign=
"top" class=
"required">
312 <td align=
"right" valign=
"top">
313 <label for=
"menustdchangepassword"><?php print_string('stdchangepassword', 'auth') ?></label>
316 <?php echo html_writer
::select($yesno, 'stdchangepassword', $config->stdchangepassword
, false); ?>
318 <td align=
"left" valign=
"top">
319 <p><?php print_string('stdchangepassword_expl', 'auth') ?></p>
320 <p><?php print_string('stdchangepassword_explldap', 'auth') ?></p>
323 <tr valign=
"top" class=
"required">
325 <label for=
"menupasstype"><?php print_string('auth_ldap_passtype_key', 'auth_ldap') ?></label>
330 $passtype['plaintext'] = get_string('plaintext', 'auth');
331 $passtype['md5'] = get_string('md5', 'auth');
332 $passtype['sha1'] = get_string('sha1', 'auth');
333 echo html_writer
::select($passtype, 'passtype', $config->passtype
, false);
337 <?php print_string('auth_ldap_passtype', 'auth_ldap') ?>
342 <label for=
"changepasswordurl"><?php print_string('auth_ldap_changepasswordurl_key', 'auth_ldap') ?></label>
345 <input name=
"changepasswordurl" id=
"changepasswordurl" type=
"text" value=
"<?php echo $config->changepasswordurl ?>" />
346 <?php
if (isset($err['changepasswordurl'])) { echo $OUTPUT->error_text($err['changepasswordurl']); } ?>
349 <?php print_string('changepasswordhelp', 'auth') ?>
354 <h4><?php print_string('auth_ldap_passwdexpire_settings', 'auth_ldap') ?></h4>
357 <tr valign=
"top" class=
"required">
359 <label for=
"menuexpiration"><?php print_string('auth_ldap_expiration_key', 'auth_ldap') ?></label>
363 $expiration = array();
364 $expiration['0'] = 'no';
365 $expiration['1'] = 'LDAP';
366 echo html_writer
::select($expiration, 'expiration', $config->expiration
, false);
367 if (isset($err['expiration'])) { echo $OUTPUT->error_text($err['expiration']); }
371 <?php print_string('auth_ldap_expiration_desc', 'auth_ldap') ?>
374 <tr valign=
"top" class=
"required">
376 <label for=
"expiration_warning"><?php print_string('auth_ldap_expiration_warning_key', 'auth_ldap') ?></label>
379 <input name=
"expiration_warning" id=
"expiration_warning" type=
"text" size=
"2" value=
"<?php echo $config->expiration_warning?>" />
380 <?php
if (isset($err['expiration_warning'])) { echo $OUTPUT->error_text($err['expiration_warning']); } ?>
383 <?php print_string('auth_ldap_expiration_warning_desc', 'auth_ldap') ?>
386 <tr valign=
"top" class=
"required">
388 <label for=
"expireattr"><?php print_string('auth_ldap_expireattr_key', 'auth_ldap') ?></label>
391 <input name=
"expireattr" id=
"expireattr" type=
"text" size=
"30" value=
"<?php echo $config->expireattr?>" />
392 <?php
if (isset($err['expireattr'])) { echo $OUTPUT->error_text($err['expireattr']); } ?>
395 <?php print_string('auth_ldap_expireattr_desc', 'auth_ldap') ?>
398 <tr valign=
"top" class=
"required">
400 <label for=
"menugracelogins"><?php print_string('auth_ldap_gracelogins_key', 'auth_ldap') ?></label>
403 <?php echo html_writer
::select($yesno, 'gracelogins', $config->gracelogins
, false); ?>
406 <?php print_string('auth_ldap_gracelogins_desc', 'auth_ldap') ?>
409 <tr valign=
"top" class=
"required">
411 <label for=
"graceattr"><?php print_string('auth_ldap_gracelogin_key', 'auth_ldap') ?></label>
414 <input name=
"graceattr" id=
"graceattr" type=
"text" size=
"30" value=
"<?php echo $config->graceattr?>" />
415 <?php
if (isset($err['graceattr'])) { echo $OUTPUT->error_text($err['graceattr']); } ?>
418 <?php print_string('auth_ldap_graceattr_desc', 'auth_ldap') ?>
423 <h4><?php print_string('auth_user_create', 'auth') ?></h4>
428 <label for=
"menuauth_user_create"><?php print_string('auth_ldap_auth_user_create_key', 'auth_ldap') ?></label>
431 <?php echo html_writer
::select($yesno, 'auth_user_create', $config->auth_user_create
, false); ?>
434 <?php print_string('auth_user_creation', 'auth'); ?>
437 <tr valign=
"top" class=
"required">
439 <label for=
"create_context"><?php print_string('auth_ldap_create_context_key', 'auth_ldap') ?></label>
442 <input name=
"create_context" id=
"create_context" type=
"text" size=
"30" value=
"<?php echo $config->create_context?>" />
443 <?php
if (isset($err['create_context'])) { echo $OUTPUT->error_text($err['create_context']); } ?>
446 <?php print_string('auth_ldap_create_context', 'auth_ldap') ?>
451 <h4><?php print_string('coursecreators') ?></h4>
454 <tr valign=
"top" class=
"required">
456 <label for=
"creators"><?php print_string('auth_ldap_creators_key', 'auth_ldap') ?></label>
459 <input name=
"creators" id=
"creators" type=
"text" size=
"30" value=
"<?php echo $config->creators?>" />
460 <?php
if (isset($err['creators'])) { echo $OUTPUT->error_text($err['creators']); } ?>
463 <?php print_string('auth_ldap_creators', 'auth_ldap') ?>
468 <h4><?php print_string('auth_sync_script', 'auth') ?></h4>
473 <label for=
"menuremoveuser"><?php print_string('auth_remove_user_key', 'auth') ?></label>
477 $deleteopt = array();
478 $deleteopt[AUTH_REMOVEUSER_KEEP
] = get_string('auth_remove_keep', 'auth');
479 $deleteopt[AUTH_REMOVEUSER_SUSPEND
] = get_string('auth_remove_suspend', 'auth');
480 $deleteopt[AUTH_REMOVEUSER_FULLDELETE
] = get_string('auth_remove_delete', 'auth');
481 echo html_writer
::select($deleteopt, 'removeuser', $config->removeuser
, false);
485 <?php print_string('auth_remove_user', 'auth') ?>
490 <h4><?php print_string('auth_ntlmsso', 'auth_ldap') ?></h4>
495 <label for=
"menuntlmsso_enabled"><?php print_string('auth_ntlmsso_enabled_key', 'auth_ldap') ?></label>
498 <?php echo html_writer
::select($yesno, 'ntlmsso_enabled', $config->ntlmsso_enabled
, false); ?>
501 <?php print_string('auth_ntlmsso_enabled', 'auth_ldap') ?>
506 <label for=
"ntlmsso_subnet"><?php print_string('auth_ntlmsso_subnet_key', 'auth_ldap') ?></label>
509 <input name=
"ntlmsso_subnet" id=
"ntlmsso_subnet" type=
"text" size=
"30" value=
"<?php p($config->ntlmsso_subnet) ?>" />
512 <?php
print_string('auth_ntlmsso_subnet', 'auth_ldap') ?>
517 <label for=
"menuntlmsso_ie_fastpath"><?php print_string('auth_ntlmsso_ie_fastpath_key', 'auth_ldap') ?></label>
520 <?php echo html_writer
::select($yesno, 'ntlmsso_ie_fastpath', $config->ntlmsso_ie_fastpath
, false); ?>
523 <?php print_string('auth_ntlmsso_ie_fastpath', 'auth_ldap') ?>
528 <label for=
"menuntlmsso_type"><?php print_string('auth_ntlmsso_type_key', 'auth_ldap')?></label>
533 $types['ntlm'] = 'NTLM';
534 $types['kerberos'] = 'Kerberos';
535 echo html_writer
::select($types, 'ntlmsso_type', $config->ntlmsso_type
, false);
539 <?php print_string('auth_ntlmsso_type','auth_ldap') ?>
543 $help = get_string('auth_ldapextrafields', 'auth_ldap');
544 $help .= get_string('auth_updatelocal_expl', 'auth');
545 $help .= get_string('auth_fieldlock_expl', 'auth');
546 $help .= get_string('auth_updateremote_expl', 'auth');
548 $help .= get_string('auth_updateremote_ldap', 'auth');
550 print_auth_lock_options('ldap', $user_fields, $help, true, true);