Issue:
[moodle-pu.git] / auth / ldap / config.html
blob30036f8a62950cee77b248a0c63029eb2f5be3dc
1 <?php
3 // set to defaults if undefined
4 if (!isset($config->host_url))
5 { $config->host_url = ''; }
6 if (empty($config->ldapencoding))
7 { $config->ldapencoding = 'utf-8'; }
8 if (!isset($config->contexts))
9 { $config->contexts = ''; }
10 if (!isset($config->user_type))
11 { $config->user_type = 'default'; }
12 if (!isset($config->user_attribute))
13 { $config->user_attribute = ''; }
14 if (!isset($config->search_sub))
15 { $config->search_sub = ''; }
16 if (!isset($config->opt_deref))
17 { $config->opt_deref = LDAP_DEREF_NEVER; }
18 if (!isset($config->preventpassindb))
19 { $config->preventpassindb = 0; }
20 if (!isset($config->bind_dn))
21 {$config->bind_dn = ''; }
22 if (!isset($config->bind_pw))
23 {$config->bind_pw = ''; }
24 if (!isset($config->version))
25 {$config->version = '2'; }
26 if (!isset($config->objectclass))
27 {$config->objectclass = ''; }
28 if (!isset($config->memberattribute))
29 {$config->memberattribute = ''; }
30 if (!isset($config->memberattribute_isdn))
31 {$config->memberattribute_isdn = ''; }
32 if (!isset($config->creators))
33 {$config->creators = ''; }
34 if (!isset($config->create_context))
35 {$config->create_context = ''; }
36 if (!isset($config->expiration))
37 {$config->expiration = ''; }
38 if (!isset($config->expiration_warning))
39 {$config->expiration_warning = '10'; }
40 if (!isset($config->expireattr))
41 {$config->expireattr = ''; }
42 if (!isset($config->gracelogins))
43 {$config->gracelogins = ''; }
44 if (!isset($config->graceattr))
45 {$config->graceattr = ''; }
46 if (!isset($config->auth_user_create))
47 {$config->auth_user_create = ''; }
48 if (!isset($config->forcechangepassword))
49 {$config->forcechangepassword = 0; }
50 if (!isset($config->stdchangepassword))
51 {$config->stdchangepassword = 0; }
52 if (!isset($config->passtype))
53 {$config->passtype = 'plaintext';}
54 if (!isset($config->changepasswordurl))
55 {$config->changepasswordurl = ''; }
56 if (!isset($config->removeuser))
57 {$config->removeuser = 0; }
59 $yesno = array( get_string('no'), get_string('yes') );
61 if (!function_exists('ldap_connect')) { // Is php4-ldap really there?
62 notify(get_string('auth_ldap_noextension','auth'));
66 <table cellspacing="0" cellpadding="5" border="0">
68 <tr>
69 <td colspan="2">
70 <h4><?php print_string('auth_ldap_server_settings', 'auth') ?> </h4>
71 </td>
72 </tr>
74 <tr valign="top" class="required">
75 <td align="right"><label for="host_url"><?php print_string('auth_ldap_host_url_key','auth') ?></label></td>
76 <td>
77 <input name="host_url" id="host_url" type="text" size="30" value="<?php echo $config->host_url?>" />
78 <?php if (isset($err['host_url'])) formerr($err['host_url']); ?>
79 </td>
80 <td>
81 <?php print_string('auth_ldap_host_url','auth') ?>
82 </td>
83 </tr>
85 <tr valign="top" class="required">
86 <td align="right"><label for="menuversion"><?php print_string('auth_ldap_version_key','auth') ?></label></td>
87 <td>
88 <?php
89 $varsions = array();
90 $versions[2] = '2';
91 $versions[3] = '3';
92 choose_from_menu($versions, 'version', $config->version, '');
93 if (isset($err['version'])) formerr($err['version']);
95 </td>
96 <td>
97 <?php print_string('auth_ldap_version','auth') ?>
98 </td>
99 </tr>
101 <tr valign="top" class="required">
102 <td align="right"><label for="ldapencoding"><?php print_string("auth_ldap_ldap_encoding_key", "auth") ?></label></td>
103 <td>
104 <input id="ldapencoding" name="ldapencoding" type="text" value="<?php echo $config->ldapencoding ?>" />
105 <?php
107 if (isset($err['ldapencoding'])) {
108 formerr($err['ldapencoding']);
112 </td>
113 <td><?php print_string('auth_ldap_ldap_encoding', 'auth') ?></td>
114 </tr>
116 <tr>
117 <td colspan="2">
118 <h4><?php print_string('auth_ldap_bind_settings', 'auth') ?> </h4>
119 </td>
120 </tr>
122 <tr valign="top" class="required">
123 <td align="right"><label for="menupreventpassindb"><?php print_string('auth_ldap_preventpassindb_key','auth') ?></label></td>
124 <td>
125 <?php choose_from_menu($yesno, 'preventpassindb', $config->preventpassindb, ''); ?>
126 </td><td>
127 <?php print_string('auth_ldap_preventpassindb','auth') ?>
128 </td>
129 </tr>
131 <tr valign="top" class="required">
132 <td align="right"><label for="bind_dn"><?php print_string('auth_ldap_bind_dn_key','auth') ?></label></td>
133 <td>
134 <input name="bind_dn" id="bind_dn" type="text" size="30" value="<?php echo $config->bind_dn?>" />
135 <?php if (isset($err['bind_dn'])) formerr($err['bind_dn']); ?>
136 </td><td>
137 <?php print_string('auth_ldap_bind_dn','auth') ?>
138 </td>
139 </tr>
141 <tr valign="top" class="required">
142 <td align="right"><label for="bind_pw"><?php print_string('auth_ldap_bind_pw_key','auth') ?></label></td>
143 <td>
144 <input name="bind_pw" id="bind_pw" type="password" size="30" value="<?php echo $config->bind_pw?>" />
145 <?php if (isset($err['bind_pw'])) formerr($err['bind_pw']); ?>
146 </td><td>
147 <?php print_string('auth_ldap_bind_pw','auth') ?>
148 </td>
149 </tr>
151 <tr>
152 <td colspan="2">
153 <h4><?php print_string('auth_ldap_user_settings', 'auth') ?> </h4>
154 </td>
155 </tr>
157 <tr valign="top" class="required">
158 <td align="right"><label for="menuuser_type"><?php print_string('auth_ldap_user_type_key','auth') ?></label></td>
159 <td>
160 <?php choose_from_menu($this->ldap_suppported_usertypes(), 'user_type', $config->user_type, ''); ?>
161 <?php if (isset($err['user_type'])) formerr($err['user_type']); ?>
162 </td>
163 <td>
164 <?php print_string('auth_ldap_user_type', 'auth') ?>
165 </td>
166 </tr>
168 <tr valign="top" class="required">
169 <td align="right"><label for="contexts"><?php print_string('auth_ldap_contexts_key','auth') ?></label></td>
170 <td>
171 <input name="contexts" id="contexts" type="text" size="30" value="<?php echo $config->contexts?>" />
172 <?php if (isset($err['contexts'])) formerr($err['contexts']); ?>
173 </td>
174 <td>
175 <?php print_string('auth_ldap_contexts', 'auth') ?>
176 </td>
177 </tr>
179 <tr valign="top" class="required">
180 <td align="right"><label for="menusearch_sub"><?php print_string('auth_ldap_search_sub_key','auth') ?></label></td>
181 <td>
182 <?php choose_from_menu($yesno, 'search_sub', $config->search_sub, ''); ?>
183 </td>
184 <td>
185 <?php print_string('auth_ldap_search_sub','auth') ?>
186 </td>
187 </tr>
189 <tr valign="top" class="required">
190 <td align="right"><label for="menuopt_deref"><?php print_string('auth_ldap_opt_deref_key','auth') ?></label></td>
191 <td>
192 <?php
193 $opt_deref = array();
194 $opt_deref[LDAP_DEREF_NEVER] = get_string('no');
195 $opt_deref[LDAP_DEREF_ALWAYS] = get_string('yes');
196 choose_from_menu($opt_deref, 'opt_deref', $config->opt_deref, LDAP_DEREF_NEVER, '');
197 if (isset($err['opt_deref'])) formerr($err['opt_deref']);
199 </td>
200 <td>
201 <?php print_string('auth_ldap_opt_deref','auth') ?>
202 </td>
203 </tr>
207 <tr valign="top" class="required">
208 <td align="right"><label for="user_attribute"><?php print_string('auth_ldap_user_attribute_key','auth') ?></label></td>
209 <td>
210 <input name="user_attribute" id="user_attribute" type="text" size="30" value="<?php echo $config->user_attribute?>" />
211 <?php if (isset($err['user_attribute'])) formerr($err['user_attribute']); ?>
212 </td>
213 <td>
214 <?php print_string('auth_ldap_user_attribute','auth') ?>
215 </td>
216 </tr>
218 <tr valign="top" class="required">
219 <td align="right"><label for="memberattribute"><?php print_string('auth_ldap_memberattribute_key','auth') ?></label></td>
220 <td>
221 <input name="memberattribute" id="memberattribute" type="text" size="30" value="<?php echo $config->memberattribute?>" />
222 <?php if (isset($err['memberattribute'])) formerr($err['memberattribute']); ?>
223 </td><td>
224 <?php print_string('auth_ldap_memberattribute','auth') ?>
225 </td>
226 </tr>
228 <tr valign="top" class="required">
229 <td align="right"><label for="memberattribute_isdn"><?php print_string('auth_ldap_memberattribute_isdn_key','auth') ?></label></td>
230 <td>
231 <input name="memberattribute_isdn" id="memberattribute_isdn" type="text" size="30" value="<?php echo $config->memberattribute_isdn?>" />
232 <?php if (isset($err['memberattribute_isdn'])) formerr($err['memberattribute_isdn']); ?>
233 </td><td>
234 <?php print_string('auth_ldap_memberattribute_isdn','auth') ?>
235 </td>
236 </tr>
238 <tr valign="top" class="required">
239 <td align="right"><label for="objectclass"><?php print_string('auth_ldap_objectclass_key','auth') ?></label></td>
240 <td>
241 <input name="objectclass" id="objectclass" type="text" size="30" value="<?php echo $config->objectclass?>" />
242 <?php if (isset($err['objectclass'])) formerr($err['objectclass']); ?>
243 </td>
244 <td>
245 <?php print_string('auth_ldap_objectclass','auth') ?>
246 </td>
247 </tr>
249 <tr>
250 <td colspan="2">
251 <h4><?php print_string('forcechangepassword', 'auth') ?> </h4>
252 </td>
253 </tr>
255 <tr valign="top" class="required">
256 <td align="right" valign="top"><label for="menuforcechangepassword"><?php print_string('forcechangepassword', 'auth') ?></label></td>
257 <td>
258 <?php choose_from_menu($yesno, 'forcechangepassword', $config->forcechangepassword, ''); ?>
259 </td>
260 <td align="left" valign="top">
261 <p><?php print_string('forcechangepasswordfirst_help', 'auth') ?></p>
262 </td>
263 </tr>
265 <tr valign="top" class="required">
266 <td align="right" valign="top"><label for="menustdchangepassword"><?php print_string('stdchangepassword', 'auth') ?></label></td>
267 <td>
268 <?php choose_from_menu($yesno, 'stdchangepassword', $config->stdchangepassword, ''); ?>
269 </td>
270 <td align="left" valign="top">
271 <p><?php print_string('stdchangepassword_expl', 'auth') ?></p>
272 <p><?php print_string('stdchangepassword_explldap', 'auth') ?></p>
273 </td>
274 </tr>
276 <tr valign="top" class="required">
277 <td align="right"><label for="menupasstype"><?php print_string('auth_ldap_passtype_key', 'auth') ?></label></td>
278 <td>
279 <?php
280 $passtype = array();
281 $passtype['plaintext'] = get_string('plaintext', 'auth');
282 $passtype['md5'] = get_string('md5', 'auth');
283 $passtype['sha1'] = get_string('sha1', 'auth');
284 choose_from_menu($passtype, 'passtype', $config->passtype, '');
287 </td>
288 <td><?php print_string('auth_ldap_passtype', 'auth') ?></td>
289 </tr>
291 <tr valign="top">
292 <td align="right"><label for="changepasswordurl"><?php print_string('auth_ldap_changepasswordurl_key','auth') ?></label></td>
293 <td>
294 <input name="changepasswordurl" id="changepasswordurl" type="text" value="<?php echo $config->changepasswordurl ?>" />
295 <?php
297 if (isset($err['changepasswordurl'])) {
298 formerr($err['changepasswordurl']);
302 </td>
303 <td><?php print_string('changepasswordhelp', 'auth') ?></td>
304 </tr>
306 <tr>
307 <td colspan="2">
308 <h4><?php print_string('auth_ldap_passwdexpire_settings', 'auth') ?> </h4>
309 </td>
310 </tr>
312 <tr valign="top" class="required">
313 <td align="right"><label for="menuexpiration"><?php print_string('auth_ldap_expiration_key','auth') ?></label></td>
314 <td>
315 <?php
316 $expiration = array();
317 $expiration['0'] = 'no';
318 $expiration['1'] = 'LDAP';
319 choose_from_menu($expiration, 'expiration', $config->expiration, '');
320 if (isset($err['expiration'])) formerr($err['expiration']);
322 </td>
323 <td>
324 <?php print_string('auth_ldap_expiration_desc','auth') ?>
325 </td>
326 </tr>
329 <tr valign="top" class="required">
330 <td align="right"><label for="expiration_warning"><?php print_string('auth_ldap_expiration_warning_key','auth') ?></label></td>
331 <td>
332 <input name="expiration_warning" id="expiration_warning" type="text" size="2" value="<?php echo $config->expiration_warning?>" />
333 <?php if (isset($err['expiration_warning'])) formerr($err['expiration_warning']);
335 </td>
336 <td>
337 <?php print_string('auth_ldap_expiration_warning_desc','auth') ?>
338 </td>
339 </tr>
341 <tr valign="top" class="required">
342 <td align="right"><label for="expireattr"><?php print_string('auth_ldap_expireattr_key','auth') ?></label></td>
343 <td>
344 <input name="expireattr" id="expireattr" type="text" size="30" value="<?php echo $config->expireattr?>" />
345 <?php if (isset($err['expireattr'])) formerr($err['expireattr']);
347 </td>
348 <td>
349 <?php print_string('auth_ldap_expireattr_desc','auth') ?>
350 </td>
351 </tr>
353 <tr valign="top" class="required">
354 <td align="right"><label for="menugracelogins"><?php print_string('auth_ldap_gracelogins_key','auth') ?></label></td>
355 <td>
356 <?php choose_from_menu($yesno, 'gracelogins', $config->gracelogins, ''); ?>
357 </td>
358 <td>
359 <?php print_string('auth_ldap_gracelogins_desc','auth') ?>
360 </td>
361 </tr>
363 <tr valign="top" class="required">
364 <td align="right"><label for="graceattr"><?php print_string('auth_ldap_gracelogin_key','auth') ?></label></td>
365 <td>
366 <input name="graceattr" id="graceattr" type="text" size="30" value="<?php echo $config->graceattr?>" />
367 <?php if (isset($err['graceattr'])) formerr($err['graceattr']);
369 </td>
370 <td>
371 <?php print_string('auth_ldap_graceattr_desc','auth') ?>
372 </td>
373 </tr>
377 <tr>
378 <td colspan="2">
379 <h4><?php print_string('auth_user_create', 'auth') ?> </h4>
380 </td>
381 </tr>
383 <tr valign="top">
384 <td align="right"><label for="menuauth_user_create"><?php print_string('auth_ldap_auth_user_create_key','auth') ?></label></td>
385 <td>
386 <?php choose_from_menu($yesno, 'auth_user_create', $config->auth_user_create, ''); ?>
387 </td>
388 <td>
389 <?php print_string("auth_user_creation","auth"); ?>
390 </td>
391 </tr>
393 <tr valign="top" class="required">
394 <td align="right"><label for="create_context"><?php print_string('auth_ldap_create_context_key','auth') ?></label></td>
395 <td>
396 <input name="create_context" id="create_context" type="text" size="30" value="<?php echo $config->create_context?>" />
397 <?php if (isset($err['create_context'])) formerr($err['create_context']); ?>
398 </td><td>
399 <?php print_string('auth_ldap_create_context','auth') ?>
400 </td>
401 </tr>
404 <tr>
405 <td colspan="2">
406 <h4><?php print_string('coursecreators') ?> </h4>
407 </td>
408 </tr>
410 <tr valign="top" class="required">
411 <td align="right"><label for="creators"><?php print_string('auth_ldap_creators_key','auth') ?></label></td>
412 <td>
413 <input name="creators" id="creators" type="text" size="30" value="<?php echo $config->creators?>" />
414 <?php if (isset($err['creators'])) formerr($err['creators']); ?>
415 </td><td>
416 <?php print_string('auth_ldap_creators','auth') ?>
417 </td>
418 </tr>
420 <tr>
421 <td colspan="2">
422 <h4><?php print_string('auth_sync_script', 'auth') ?> </h4>
423 </td>
424 </tr>
426 <tr valign="top">
427 <td align="right"><label for="menuremoveuser"><?php print_string('auth_remove_user_key','auth') ?></label></td>
428 <td>
429 <?php
430 $deleteopt = array();
431 $deleteopt['0'] = get_string('auth_remove_keep','auth');
432 $deleteopt['1'] = get_string('auth_remove_suspend','auth');
433 $deleteopt['2'] = get_string('auth_remove_delete','auth');
434 choose_from_menu($deleteopt, 'removeuser', $config->removeuser, '');
436 </td>
437 <td>
438 <?php print_string('auth_remove_user','auth') ?>
439 </td>
440 </tr>
442 <?php
444 $help = get_string('auth_ldapextrafields','auth');
445 $help .= get_string('auth_updatelocal_expl','auth');
446 $help .= get_string('auth_fieldlock_expl','auth');
447 $help .= get_string('auth_updateremote_expl','auth');
448 $help .= '<hr />';
449 $help .= get_string('auth_updateremote_ldap','auth');
451 print_auth_lock_options('ldap', $user_fields, $help, true, true);
455 </table>