3 // Set to defaults if undefined
4 if (!isset($config->host_url
)) {
5 $config->host_url
= '';
7 if (!isset($config->start_tls
)) {
8 $config->start_tls
= false;
10 if (empty($config->ldapencoding
)) {
11 $config->ldapencoding
= 'utf-8';
13 if (!isset($config->pagesize
)) {
14 $config->pagesize
= LDAP_DEFAULT_PAGESIZE
;
16 if (!isset($config->contexts
)) {
17 $config->contexts
= '';
19 if (!isset($config->user_type
)) {
20 $config->user_type
= 'default';
22 if (!isset($config->user_attribute
)) {
23 $config->user_attribute
= '';
25 if (!isset($config->suspended_attribute
)) {
26 $config->suspended_attribute
= '';
28 if (!isset($config->sync_suspended
)) {
29 $config->sync_suspended
= '';
31 if (!isset($config->search_sub
)) {
32 $config->search_sub
= '';
34 if (!isset($config->opt_deref
)) {
35 $config->opt_deref
= LDAP_DEREF_NEVER
;
37 if (!isset($config->preventpassindb
)) {
38 $config->preventpassindb
= 0;
40 if (!isset($config->bind_dn
)) {
41 $config->bind_dn
= '';
43 if (!isset($config->bind_pw
)) {
44 $config->bind_pw
= '';
46 if (!isset($config->ldap_version
)) {
47 $config->ldap_version
= '3';
49 if (!isset($config->objectclass
)) {
50 $config->objectclass
= '';
52 if (!isset($config->memberattribute
)) {
53 $config->memberattribute
= '';
55 if (!isset($config->memberattribute_isdn
)) {
56 $config->memberattribute_isdn
= '';
58 if (!isset($config->creators
)) {
59 $config->creators
= '';
61 if (!isset($config->create_context
)) {
62 $config->create_context
= '';
64 if (!isset($config->expiration
)) {
65 $config->expiration
= '';
67 if (!isset($config->expiration_warning
)) {
68 $config->expiration_warning
= '10';
70 if (!isset($config->expireattr
)) {
71 $config->expireattr
= '';
73 if (!isset($config->gracelogins
)) {
74 $config->gracelogins
= '';
76 if (!isset($config->graceattr
)) {
77 $config->graceattr
= '';
79 if (!isset($config->auth_user_create
)) {
80 $config->auth_user_create
= '';
82 if (!isset($config->forcechangepassword
)) {
83 $config->forcechangepassword
= 0;
85 if (!isset($config->stdchangepassword
)) {
86 $config->stdchangepassword
= 0;
88 if (!isset($config->passtype
)) {
89 $config->passtype
= 'plaintext';
91 if (!isset($config->changepasswordurl
)) {
92 $config->changepasswordurl
= '';
94 if (!isset($config->removeuser
)) {
95 $config->removeuser
= AUTH_REMOVEUSER_KEEP
;
97 if (!isset($config->ntlmsso_enabled
)) {
98 $config->ntlmsso_enabled
= 0;
100 if (!isset($config->ntlmsso_subnet
)) {
101 $config->ntlmsso_subnet
= '';
103 if (!isset($config->ntlmsso_ie_fastpath
)) {
104 $config->ntlmsso_ie_fastpath
= 0;
106 if (!isset($config->ntlmsso_type
)) {
107 $config->ntlmsso_type
= 'ntlm';
109 if (!isset($config->ntlmsso_remoteuserformat
)) {
110 $config->ntlmsso_remoteuserformat
= '';
113 $yesno = array(get_string('no'), get_string('yes'));
115 $fastpathoptions = array(AUTH_NTLM_FASTPATH_YESFORM
=> get_string('auth_ntlmsso_ie_fastpath_yesform', 'auth_ldap'),
116 AUTH_NTLM_FASTPATH_YESATTEMPT
=> get_string('auth_ntlmsso_ie_fastpath_yesattempt', 'auth_ldap'),
117 AUTH_NTLM_FASTPATH_ATTEMPT
=> get_string('auth_ntlmsso_ie_fastpath_attempt', 'auth_ldap'));
120 if (!ldap_paged_results_supported($config->ldap_version
)) {
121 $disabled = ' disabled="disabled"';
122 echo $OUTPUT->notification(get_string('pagedresultsnotsupp', 'auth_ldap'));
126 <table cellspacing=
"0" cellpadding=
"5" border=
"0">
129 <h4><?php print_string('auth_ldap_server_settings', 'auth_ldap') ?></h4>
132 <tr valign=
"top" class=
"required">
134 <label for=
"host_url"><?php print_string('auth_ldap_host_url_key', 'auth_ldap') ?></label>
137 <input name=
"host_url" id=
"host_url" type=
"text" class=
"text-ltr" size=
"30" value=
"<?php echo $config->host_url?>" />
138 <?php
if (isset($err['host_url'])) { echo $OUTPUT->error_text($err['host_url']); } ?>
141 <?php print_string('auth_ldap_host_url', 'auth_ldap') ?>
144 <tr valign=
"top" class=
"required">
146 <label for=
"ldap_version"><?php print_string('auth_ldap_version_key', 'auth_ldap') ?></label>
153 echo html_writer
::select($versions, 'ldap_version', $config->ldap_version
, false);
154 if (isset($err['ldap_version'])) { echo $OUTPUT->error_text($err['ldap_version']); }
158 <?php print_string('auth_ldap_version', 'auth_ldap') ?>
163 <label for=
"start_tls"><?php print_string('start_tls_key', 'auth_ldap') ?></label>
166 <?php echo html_writer
::select($yesno, 'start_tls', $config->start_tls
, false); ?>
169 <?php print_string('start_tls', 'auth_ldap') ?>
172 <tr valign=
"top" class=
"required">
174 <label for=
"ldapencoding"><?php print_string('auth_ldap_ldap_encoding_key', 'auth_ldap') ?></label>
177 <input id=
"ldapencoding" name=
"ldapencoding" type=
"text" class=
"text-ltr" value=
"<?php echo $config->ldapencoding ?>" />
178 <?php
if (isset($err['ldapencoding'])) { echo $OUTPUT->error_text($err['ldapencoding']); } ?>
181 <?php print_string('auth_ldap_ldap_encoding', 'auth_ldap') ?>
186 <label for=
"pagesize"><?php print_string('pagesize_key', 'auth_ldap') ?></label>
189 <input id=
"pagesize" name=
"pagesize" type=
"text" class=
"text-ltr" value=
"<?php echo $config->pagesize ?>" <?php
echo $disabled ?>/>
191 if (isset($err['pagesize'])) { echo $OUTPUT->error_text($err['pagesize']); }
193 // Don't loose the page size value (disabled fields are not submitted!)
195 <input id=
"pagesize" name=
"pagesize" type=
"hidden" value=
"<?php echo $config->pagesize ?>" />
200 <?php print_string('pagesize', 'auth_ldap') ?>
205 <h4><?php print_string('auth_ldap_bind_settings', 'auth_ldap') ?></h4>
208 <tr valign=
"top" class=
"required">
210 <label for=
"menupreventpassindb"><?php print_string('auth_ldap_preventpassindb_key', 'auth_ldap') ?></label>
213 <?php echo html_writer
::select($yesno, 'preventpassindb', $config->preventpassindb
, false); ?>
216 <?php print_string('auth_ldap_preventpassindb', 'auth_ldap') ?>
219 <tr valign=
"top" class=
"required">
221 <label for=
"bind_dn"><?php print_string('auth_ldap_bind_dn_key', 'auth_ldap') ?></label>
224 <input name=
"bind_dn" id=
"bind_dn" type=
"text" class=
"text-ltr" size=
"30" value=
"<?php echo $config->bind_dn?>" />
225 <?php
if (isset($err['bind_dn'])) { echo $OUTPUT->error_text($err['bind_dn']); } ?>
228 <?php print_string('auth_ldap_bind_dn', 'auth_ldap') ?>
231 <tr valign=
"top" class=
"required">
233 <label for=
"bind_pw"><?php print_string('auth_ldap_bind_pw_key', 'auth_ldap') ?></label>
236 <input name=
"bind_pw" id=
"bind_pw" type=
"password" class=
"text-ltr" size=
"30" value=
"<?php echo $config->bind_pw?>" autocomplete
="off"/>
237 <?php
if (isset($err['bind_pw'])) { echo $OUTPUT->error_text($err['bind_pw']); } ?>
240 <?php print_string('auth_ldap_bind_pw', 'auth_ldap') ?>
245 <h4><?php print_string('auth_ldap_user_settings', 'auth_ldap') ?></h4>
248 <tr valign=
"top" class=
"required">
250 <label for=
"menuuser_type"><?php print_string('auth_ldap_user_type_key', 'auth_ldap') ?></label>
254 echo html_writer
::select(ldap_supported_usertypes(), 'user_type', $config->user_type
, false);
255 if (isset($err['user_type'])) { echo $OUTPUT->error_text($err['user_type']); }
259 <?php print_string('auth_ldap_user_type', 'auth_ldap') ?>
262 <tr valign=
"top" class=
"required">
264 <label for=
"contexts"><?php print_string('auth_ldap_contexts_key', 'auth_ldap') ?></label>
267 <input name=
"contexts" id=
"contexts" type=
"text" class=
"text-ltr" size=
"30" value=
"<?php echo $config->contexts?>" />
268 <?php
if (isset($err['contexts'])) { echo $OUTPUT->error_text($err['contexts']); } ?>
271 <?php print_string('auth_ldap_contexts', 'auth_ldap') ?>
274 <tr valign=
"top" class=
"required">
276 <label for=
"menusearch_sub"><?php print_string('auth_ldap_search_sub_key', 'auth_ldap') ?></label>
279 <?php echo html_writer
::select($yesno, 'search_sub', $config->search_sub
, false); ?>
282 <?php print_string('auth_ldap_search_sub', 'auth_ldap') ?>
285 <tr valign=
"top" class=
"required">
287 <label for=
"menuopt_deref"><?php print_string('auth_ldap_opt_deref_key', 'auth_ldap') ?></label>
291 $opt_deref = array();
292 $opt_deref[LDAP_DEREF_NEVER
] = get_string('no');
293 $opt_deref[LDAP_DEREF_ALWAYS
] = get_string('yes');
294 echo html_writer
::select($opt_deref, 'opt_deref', $config->opt_deref
, false);
295 if (isset($err['opt_deref'])) { echo $OUTPUT->error_text($err['opt_deref']); }
299 <?php print_string('auth_ldap_opt_deref', 'auth_ldap') ?>
302 <tr valign=
"top" class=
"required">
304 <label for=
"user_attribute"><?php print_string('auth_ldap_user_attribute_key', 'auth_ldap') ?></label>
307 <input name=
"user_attribute" id=
"user_attribute" type=
"text" class=
"text-ltr" size=
"30" value=
"<?php echo $config->user_attribute?>" />
308 <?php
if (isset($err['user_attribute'])) { echo $OUTPUT->error_text($err['user_attribute']); } ?>
311 <?php print_string('auth_ldap_user_attribute', 'auth_ldap') ?>
314 <tr valign=
"top" class=
"required">
316 <label for=
"suspended_attribute"><?php print_string('auth_ldap_suspended_attribute_key', 'auth_ldap') ?></label>
319 <input name=
"suspended_attribute" id=
"suspended_attribute" type=
"text" class=
"text-ltr" size=
"30" value=
"<?php echo $config->suspended_attribute?>" />
320 <?php
if (isset($err['suspended_attribute'])) { echo $OUTPUT->error_text($err['suspended_attribute']); } ?>
323 <?php print_string('auth_ldap_suspended_attribute', 'auth_ldap') ?>
326 <tr valign=
"top" class=
"required">
328 <label for=
"memberattribute"><?php print_string('auth_ldap_memberattribute_key', 'auth_ldap') ?></label>
331 <input name=
"memberattribute" id=
"memberattribute" type=
"text" class=
"text-ltr" size=
"30" value=
"<?php echo $config->memberattribute?>" />
332 <?php
if (isset($err['memberattribute'])) { echo $OUTPUT->error_text($err['memberattribute']); } ?>
335 <?php print_string('auth_ldap_memberattribute', 'auth_ldap') ?>
338 <tr valign=
"top" class=
"required">
340 <label for=
"memberattribute_isdn"><?php print_string('auth_ldap_memberattribute_isdn_key', 'auth_ldap') ?></label>
343 <input name=
"memberattribute_isdn" id=
"memberattribute_isdn" type=
"text" class=
"text-ltr" size=
"30" value=
"<?php echo $config->memberattribute_isdn?>" />
344 <?php
if (isset($err['memberattribute_isdn'])) { echo $OUTPUT->error_text($err['memberattribute_isdn']); } ?>
347 <?php print_string('auth_ldap_memberattribute_isdn', 'auth_ldap') ?>
350 <tr valign=
"top" class=
"required">
352 <label for=
"objectclass"><?php print_string('auth_ldap_objectclass_key', 'auth_ldap') ?></label>
355 <input name=
"objectclass" id=
"objectclass" type=
"text" class=
"text-ltr" size=
"30" value=
"<?php echo $config->objectclass?>" />
356 <?php
if (isset($err['objectclass'])) { echo $OUTPUT->error_text($err['objectclass']); } ?>
359 <?php print_string('auth_ldap_objectclass', 'auth_ldap') ?>
364 <h4><?php print_string('forcechangepassword', 'auth') ?></h4>
367 <tr valign=
"top" class=
"required">
368 <td align=
"right" valign=
"top">
369 <label for=
"menuforcechangepassword"><?php print_string('forcechangepassword', 'auth') ?></label>
372 <?php echo html_writer
::select($yesno, 'forcechangepassword', $config->forcechangepassword
, false); ?>
374 <td align=
"left" valign=
"top">
375 <p><?php print_string('forcechangepasswordfirst_help', 'auth') ?></p>
378 <tr valign=
"top" class=
"required">
379 <td align=
"right" valign=
"top">
380 <label for=
"menustdchangepassword"><?php print_string('stdchangepassword', 'auth') ?></label>
383 <?php echo html_writer
::select($yesno, 'stdchangepassword', $config->stdchangepassword
, false); ?>
385 <td align=
"left" valign=
"top">
386 <p><?php print_string('stdchangepassword_expl', 'auth') ?></p>
387 <p><?php print_string('stdchangepassword_explldap', 'auth') ?></p>
390 <tr valign=
"top" class=
"required">
392 <label for=
"menupasstype"><?php print_string('auth_ldap_passtype_key', 'auth_ldap') ?></label>
397 $passtype['plaintext'] = get_string('plaintext', 'auth');
398 $passtype['md5'] = get_string('md5', 'auth');
399 $passtype['sha1'] = get_string('sha1', 'auth');
400 echo html_writer
::select($passtype, 'passtype', $config->passtype
, false);
404 <?php print_string('auth_ldap_passtype', 'auth_ldap') ?>
409 <label for=
"changepasswordurl"><?php print_string('auth_ldap_changepasswordurl_key', 'auth_ldap') ?></label>
412 <input name=
"changepasswordurl" id=
"changepasswordurl" type=
"text" class=
"text-ltr" value=
"<?php echo $config->changepasswordurl ?>" />
413 <?php
if (isset($err['changepasswordurl'])) { echo $OUTPUT->error_text($err['changepasswordurl']); } ?>
416 <?php print_string('changepasswordhelp', 'auth') ?>
421 <h4><?php print_string('auth_ldap_passwdexpire_settings', 'auth_ldap') ?></h4>
424 <tr valign=
"top" class=
"required">
426 <label for=
"menuexpiration"><?php print_string('auth_ldap_expiration_key', 'auth_ldap') ?></label>
430 $expiration = array();
431 $expiration['0'] = 'no';
432 $expiration['1'] = 'LDAP';
433 echo html_writer
::select($expiration, 'expiration', $config->expiration
, false);
434 if (isset($err['expiration'])) { echo $OUTPUT->error_text($err['expiration']); }
438 <?php print_string('auth_ldap_expiration_desc', 'auth_ldap') ?>
441 <tr valign=
"top" class=
"required">
443 <label for=
"expiration_warning"><?php print_string('auth_ldap_expiration_warning_key', 'auth_ldap') ?></label>
446 <input name=
"expiration_warning" id=
"expiration_warning" type=
"text" class=
"text-ltr" size=
"2" value=
"<?php echo $config->expiration_warning?>" />
447 <?php
if (isset($err['expiration_warning'])) { echo $OUTPUT->error_text($err['expiration_warning']); } ?>
450 <?php print_string('auth_ldap_expiration_warning_desc', 'auth_ldap') ?>
453 <tr valign=
"top" class=
"required">
455 <label for=
"expireattr"><?php print_string('auth_ldap_expireattr_key', 'auth_ldap') ?></label>
458 <input name=
"expireattr" id=
"expireattr" type=
"text" class=
"text-ltr" size=
"30" value=
"<?php echo $config->expireattr?>" />
459 <?php
if (isset($err['expireattr'])) { echo $OUTPUT->error_text($err['expireattr']); } ?>
462 <?php print_string('auth_ldap_expireattr_desc', 'auth_ldap') ?>
465 <tr valign=
"top" class=
"required">
467 <label for=
"menugracelogins"><?php print_string('auth_ldap_gracelogins_key', 'auth_ldap') ?></label>
470 <?php echo html_writer
::select($yesno, 'gracelogins', $config->gracelogins
, false); ?>
473 <?php print_string('auth_ldap_gracelogins_desc', 'auth_ldap') ?>
476 <tr valign=
"top" class=
"required">
478 <label for=
"graceattr"><?php print_string('auth_ldap_gracelogin_key', 'auth_ldap') ?></label>
481 <input name=
"graceattr" id=
"graceattr" type=
"text" class=
"text-ltr" size=
"30" value=
"<?php echo $config->graceattr?>" />
482 <?php
if (isset($err['graceattr'])) { echo $OUTPUT->error_text($err['graceattr']); } ?>
485 <?php print_string('auth_ldap_graceattr_desc', 'auth_ldap') ?>
490 <h4><?php print_string('auth_user_create', 'auth') ?></h4>
495 <label for=
"menuauth_user_create"><?php print_string('auth_ldap_auth_user_create_key', 'auth_ldap') ?></label>
498 <?php echo html_writer
::select($yesno, 'auth_user_create', $config->auth_user_create
, false); ?>
501 <?php print_string('auth_user_creation', 'auth'); ?>
504 <tr valign=
"top" class=
"required">
506 <label for=
"create_context"><?php print_string('auth_ldap_create_context_key', 'auth_ldap') ?></label>
509 <input name=
"create_context" id=
"create_context" type=
"text" class=
"text-ltr" size=
"30" value=
"<?php echo $config->create_context?>" />
510 <?php
if (isset($err['create_context'])) { echo $OUTPUT->error_text($err['create_context']); } ?>
513 <?php print_string('auth_ldap_create_context', 'auth_ldap') ?>
518 <h4><?php print_string('coursecreators') ?></h4>
521 <tr valign=
"top" class=
"required">
523 <label for=
"creators"><?php print_string('auth_ldap_creators_key', 'auth_ldap') ?></label>
526 <input name=
"creators" id=
"creators" type=
"text" class=
"text-ltr" size=
"30" value=
"<?php echo $config->creators?>" />
527 <?php
if (isset($err['creators'])) { echo $OUTPUT->error_text($err['creators']); } ?>
530 <?php print_string('auth_ldap_creators', 'auth_ldap') ?>
535 <h4><?php print_string('auth_sync_script', 'auth') ?></h4>
540 <label for=
"menuremoveuser"><?php print_string('auth_remove_user_key', 'auth') ?></label>
544 $deleteopt = array();
545 $deleteopt[AUTH_REMOVEUSER_KEEP
] = get_string('auth_remove_keep', 'auth');
546 $deleteopt[AUTH_REMOVEUSER_SUSPEND
] = get_string('auth_remove_suspend', 'auth');
547 $deleteopt[AUTH_REMOVEUSER_FULLDELETE
] = get_string('auth_remove_delete', 'auth');
548 echo html_writer
::select($deleteopt, 'removeuser', $config->removeuser
, false);
552 <?php print_string('auth_remove_user', 'auth') ?>
557 <label for=
"menusync_suspended"><?php print_string('auth_sync_suspended_key', 'auth') ?></label>
560 <?php echo html_writer
::select($yesno, 'sync_suspended', $config->sync_suspended
, false); ?>
563 <?php print_string('auth_sync_suspended', 'auth'); ?>
568 <h4><?php print_string('auth_ntlmsso', 'auth_ldap') ?></h4>
573 <label for=
"menuntlmsso_enabled"><?php print_string('auth_ntlmsso_enabled_key', 'auth_ldap') ?></label>
576 <?php echo html_writer
::select($yesno, 'ntlmsso_enabled', $config->ntlmsso_enabled
, false); ?>
579 <?php print_string('auth_ntlmsso_enabled', 'auth_ldap') ?>
584 <label for=
"ntlmsso_subnet"><?php print_string('auth_ntlmsso_subnet_key', 'auth_ldap') ?></label>
587 <input name=
"ntlmsso_subnet" id=
"ntlmsso_subnet" type=
"text" class=
"text-ltr" size=
"30" value=
"<?php p($config->ntlmsso_subnet) ?>" />
590 <?php
print_string('auth_ntlmsso_subnet', 'auth_ldap') ?>
595 <label for=
"menuntlmsso_ie_fastpath"><?php print_string('auth_ntlmsso_ie_fastpath_key', 'auth_ldap') ?></label>
598 <?php echo html_writer
::select($fastpathoptions, 'ntlmsso_ie_fastpath', $config->ntlmsso_ie_fastpath
, false); ?>
601 <?php print_string('auth_ntlmsso_ie_fastpath', 'auth_ldap') ?>
606 <label for=
"menuntlmsso_type"><?php print_string('auth_ntlmsso_type_key', 'auth_ldap')?></label>
611 $types['ntlm'] = 'NTLM';
612 $types['kerberos'] = 'Kerberos';
613 echo html_writer
::select($types, 'ntlmsso_type', $config->ntlmsso_type
, false);
617 <?php print_string('auth_ntlmsso_type','auth_ldap') ?>
622 <label for=
"ntlmsso_remoteuserformat"><?php print_string('auth_ntlmsso_remoteuserformat_key', 'auth_ldap') ?></label>
625 <input name=
"ntlmsso_remoteuserformat" id=
"ntlmsso_remoteuserformat" type=
"text" class=
"text-ltr" size=
"30" value=
"<?php echo $config->ntlmsso_remoteuserformat?>" />
626 <?php
if (isset($err['ntlmsso_remoteuserformat'])) { echo $OUTPUT->error_text($err['ntlmsso_remoteuserformat']); } ?>
629 <?php print_string('auth_ntlmsso_remoteuserformat', 'auth_ldap') ?>
633 $help = get_string('auth_ldapextrafields', 'auth_ldap');
634 $help .= get_string('auth_updatelocal_expl', 'auth');
635 $help .= get_string('auth_fieldlock_expl', 'auth');
636 $help .= get_string('auth_updateremote_expl', 'auth');
638 $help .= get_string('auth_updateremote_ldap', 'auth');
640 print_auth_lock_options($this->authtype
, $user_fields, $help, true, true, $this->get_custom_user_profile_fields());