1bb2fe8d1f7e8909f47f21e1dc76084398a67d6c
[moodle.git] / auth / cas / config.html
1 <?php
5     global $CFG;
7     require_once 'languages.php';
11     $createoptions[0] = get_string("no");
13     $createoptions[1] = get_string("yes");
17     // set to defaults if undefined (CAS)
19     if (!isset ($config->hostname))
21         $config->hostname = '';
23     if (!isset ($config->port))
25         $config->port = '';
27     if (!isset ($config->casversion))
29         $config->casversion = '';
31     if (!isset ($config->baseuri))
33         $config->baseuri = '';
35     if (!isset ($config->language))
37         $config->language = '';
39     if (!isset ($config->proxycas))
41         $config->proxycas = '';
43     if (!isset ($config->logoutcas))
45         $config->logoutcas = '';
47     if (!isset ($config->multiauth))
49         $config->multiauth = '';
51   // set to defaults if undefined (LDAP)
53     if (!isset($config->host_url))
55         { $config->host_url = ''; }
57     if (empty($config->ldapencoding))
59         { $config->ldapencoding = 'utf-8'; }
61     if (!isset($config->contexts))
63         { $config->contexts = ''; }
65     if (!isset($config->user_type))
67         { $config->user_type = 'default'; }
69     if (!isset($config->user_attribute))
71         { $config->user_attribute = ''; }
73     if (!isset($config->search_sub))
75         { $config->search_sub = ''; }
77     if (!isset($config->opt_deref))
79         { $config->opt_deref = LDAP_DEREF_NEVER; }
81     if (!isset($config->bind_dn))
83         {$config->bind_dn = ''; }
85     if (!isset($config->bind_pw))
87         {$config->bind_pw = ''; }
89     if (!isset($config->version))
91         {$config->version = '2'; }
93     if (!isset($config->objectclass))
95         {$config->objectclass = ''; }
97     if (!isset($config->memberattribute))
99         {$config->memberattribute = ''; }
101     if (!isset($config->memberattribute_isdn))
103         {$config->memberattribute_isdn = ''; }
105     if (!isset($config->groupecreators))
107         {$config->groupecreators = ''; }
109     if (!isset($config->attrcreators))
111         {$config->attrcreators = ''; }
113      if (!isset($config->removeuser))
115         {$config->removeuser = AUTH_REMOVEUSER_KEEP; }
119     $yesno = array( get_string('no'), get_string('yes') );
123 if (!function_exists('ldap_connect')) { // Is php4-ldap really there?
125     echo $OUTPUT->notification(get_string('auth_ldap_noextension','auth_ldap'));
133 ?>
137 <table cellspacing="0" cellpadding="5" border="0">
141 <tr>
143    <td colspan="2">
145         <h4><?php print_string('auth_cas_server_settings', 'auth_cas') ?> </h4>
147    </td>
149 </tr>
151 <tr valign="top" class="required">
153     <td align="right"><?php print_string('auth_cas_hostname_key', 'auth_cas') ?>:</td>
155     <td>
157         <input name="hostname" type="text" size="30" value="<?php echo $config->hostname ?>" />
159         <?php
163         if (isset($err['hostname'])) {
165             echo $OUTPUT->error_text($err['hostname']);
167         }
171         ?>
173     </td>
175     <td><?php print_string('auth_cas_hostname', 'auth_cas') ?></td>
177 </tr>
181 <tr valign="top"  class="required">
183     <td align="right"><?php print_string('auth_cas_baseuri_key', 'auth_cas') ?>:</td>
185     <td>
187         <input name="baseuri" type="text" size="30" value="<?php echo $config->baseuri ?>" />
189         <?php
193         if (isset($err['baseuri'])) {
195             echo $OUTPUT->error_text($err['baseuri']);
197         }
201         ?>
203     </td>
205     <td><?php print_string('auth_cas_baseuri', 'auth_cas') ?></td>
207 </tr>
211 <tr valign="top" class="required">
213     <td align="right"><?php print_string('auth_cas_port_key', 'auth_cas') ?>:</td>
215     <td>
217         <input name="port" type="text" size="30" value="<?php echo $config->port ?>" />
219         <?php
223         if (isset($err['port'])) {
225             echo $OUTPUT->error_text($err['port']);
227         }
231         ?>
233     </td>
235     <td><?php print_string('auth_cas_port', 'auth_cas') ?></td>
237 </tr>
241 <tr valign="top"  class="required">
243     <td align="right"><?php print_string('auth_cas_casversion', 'auth_cas') ?>:</td>
245     <td>
247         <input name="casversion" type="text" size="30" value="<?php echo $config->casversion ?>" />
249         <?php
253         if (isset($err['casversion'])) {
255             echo $OUTPUT->error_text($err['casversion']);
257         }
261         ?>
263     </td>
265     <td><?php print_string('auth_cas_version', 'auth_cas') ?></td>
267 </tr>
271 <tr valign="top"  class="required">
273     <td align="right"><?php print_string('auth_cas_language_key', 'auth_cas') ?>:</td>
275     <td>
277         <?php
281         echo $OUTPUT->select(html_select::make($CASLANGUAGES, 'language', $config->language, false));
285         ?>
287     </td>
289     <td><?php print_string('auth_cas_language', 'auth_cas') ?></td>
291 </tr>
295 <tr valign="top"  class="required">
297     <td align="right"><?php print_string('auth_cas_proxycas_key', 'auth_cas') ?>:</td>
299     <td>
301         <?php
303         unset($options);
305         $options[1] = get_string('yes');
306         $select = html_select::make($options, 'proxycas', $config->proxycas, get_string('no'));
307         $select->nothingvalue = '';
308         echo $OUTPUT->select($select);
310         ?>
312     </td>
314     <td><?php print_string('auth_cas_proxycas', 'auth_cas') ?></td>
316 </tr>
320 <tr valign="top"  class="required">
322     <td align="right"><?php print_string('auth_cas_logoutcas_key', 'auth_cas') ?>:</td>
324     <td>
326         <?php
328         unset($options);
330         $options[1] = get_string('yes');
332         $select = html_select::make($options, 'logoutcas', $config->logoutcas, get_string('no'));
333         $select->nothingvalue = '';
334         echo $OUTPUT->select($select);
336         ?>
338     </td>
340     <td><?php print_string('auth_cas_logoutcas', 'auth_cas') ?></td>
342 </tr>
346 <tr valign="top"  class="required">
348     <td align="right"><?php print_string('auth_cas_multiauth_key', 'auth_cas') ?>:</td>
350     <td>
352         <?php
354         unset($options);
356         $options[1] = get_string('yes');
358         $select = html_select::make($options, 'multiauth', $config->multiauth, get_string('no'));
359         $select->nothingvalue = '';
360         echo $OUTPUT->select($select);
362         ?>
364     </td>
366     <td><?php print_string('auth_cas_multiauth', 'auth_cas') ?></td>
368 </tr>
372 <tr>
374    <td colspan="2">
376         <h4><?php print_string('auth_ldap_server_settings', 'auth_ldap') ?> </h4>
378    </td>
380 </tr>
384 <tr valign="top" class="required">
386     <td align="right"><label for="host_url"><?php print_string('auth_ldap_host_url_key','auth_ldap') ?></label></td>
388     <td>
390         <input name="host_url" id="host_url" type="text" size="30" value="<?php echo $config->host_url?>" />
392     <?php  if (isset($err['host_url'])) echo $OUTPUT->error_text($err['host_url']); ?>
394     </td>
396     <td>
398     <?php print_string('auth_ldap_host_url','auth_ldap') ?>
400     </td>
402 </tr>
406 <tr valign="top" class="required">
408     <td align="right"><label for="menuversion"><?php print_string('auth_ldap_version_key','auth_ldap') ?></label></td>
410     <td>
412     <?php
414        $versions = array();
416        $versions[2] = '2';
418        $versions[3] = '3';
420        echo $OUTPUT->select(html_select::make($versions, 'version', $config->version, false));
422        if (isset($err['version'])) echo $OUTPUT->error_text($err['version']);
424     ?>
426     </td>
428     <td>
430     <?php print_string('auth_ldap_version','auth_ldap') ?>
432     </td>
434 </tr>
438 <tr valign="top" class="required">
440     <td align="right"><label for="ldapencoding"><?php print_string("auth_ldap_ldap_encoding_key", "auth_ldap") ?></label></td>
442     <td>
444         <input id="ldapencoding" name="ldapencoding" type="text" value="<?php echo $config->ldapencoding ?>" />
446         <?php
450         if (isset($err['ldapencoding'])) {
452             echo $OUTPUT->error_text($err['ldapencoding']);
454         }
458         ?>
460     </td>
462     <td><?php print_string('auth_ldap_ldap_encoding', 'auth_ldap') ?></td>
464 </tr>
468 <tr>
470    <td colspan="2">
472         <h4><?php print_string('auth_ldap_bind_settings', 'auth_ldap') ?> </h4>
474    </td>
476 </tr>
480 <tr valign="top" class="required">
482     <td align="right"><label for="bind_dn"><?php print_string('auth_ldap_bind_dn_key','auth_ldap') ?></label></td>
484     <td>
486     <input name="bind_dn" id="bind_dn" type="text" size="30" value="<?php echo $config->bind_dn?>" />
488     <?php  if (isset($err['bind_dn'])) echo $OUTPUT->error_text($err['bind_dn']); ?>
490     </td><td>
492     <?php print_string('auth_ldap_bind_dn','auth_ldap') ?>
494     </td>
496 </tr>
500 <tr valign="top" class="required">
502     <td align="right"><label for="bind_pw"><?php print_string('auth_ldap_bind_pw_key','auth_ldap') ?></label></td>
504     <td>
506     <input name="bind_pw" id="bind_pw" type="password" size="30" value="<?php echo $config->bind_pw?>" />
508     <?php  if (isset($err['bind_pw'])) echo $OUTPUT->error_text($err['bind_pw']); ?>
510     </td><td>
512     <?php print_string('auth_ldap_bind_pw','auth_ldap') ?>
514     </td>
516 </tr>
520 <tr>
522    <td colspan="2">
524         <h4><?php print_string('auth_ldap_user_settings', 'auth_ldap') ?> </h4>
526    </td>
528 </tr>
532 <tr valign="top" class="required">
534     <td align="right"><label for="menuuser_type"><?php print_string('auth_ldap_user_type_key','auth_ldap') ?></label></td>
536     <td>
538     <?php echo $OUTPUT->select(html_select::make($this->ldap_suppported_usertypes(), 'user_type', $config->user_type, false)); ?>
540     <?php  if (isset($err['user_type'])) echo $OUTPUT->error_text($err['user_type']); ?>
542     </td>
544     <td>
546     <?php print_string('auth_ldap_user_type', 'auth_ldap') ?>
548     </td>
550 </tr>
554 <tr valign="top" class="required">
556     <td align="right"><label for="contexts"><?php print_string('auth_ldap_contexts_key','auth_ldap') ?></label></td>
558     <td>
560     <input name="contexts" id="contexts"  type="text" size="30" value="<?php echo $config->contexts?>" />
562     <?php  if (isset($err['contexts'])) echo $OUTPUT->error_text($err['contexts']); ?>
564     </td>
566     <td>
568     <?php print_string('auth_ldap_contexts', 'auth_ldap') ?>
570     </td>
572 </tr>
576 <tr valign="top" class="required">
578     <td align="right"><label for="menusearch_sub"><?php print_string('auth_ldap_search_sub_key','auth_ldap') ?></label></td>
580     <td>
582         <?php echo $OUTPUT->select(html_select::make($yesno, 'search_sub', $config->search_sub, false)); ?>
584     </td>
586     <td>
588     <?php print_string('auth_ldap_search_sub','auth_ldap') ?>
590     </td>
592 </tr>
596 <tr valign="top" class="required">
598     <td align="right"><label for="menuopt_deref"><?php print_string('auth_ldap_opt_deref_key','auth_ldap') ?></label></td>
600     <td>
602     <?php
604        $opt_deref = array();
606        $opt_deref[LDAP_DEREF_NEVER] = get_string('no');
608        $opt_deref[LDAP_DEREF_ALWAYS] = get_string('yes');
610        echo $OUTPUT->select(html_select::make($opt_deref, 'opt_deref', $config->opt_deref, LDAP_DEREF_NEVER, false));
612        if (isset($err['opt_deref'])) echo $OUTPUT->error_text($err['opt_deref']);
614     ?>
616     </td>
618     <td>
620     <?php print_string('auth_ldap_opt_deref','auth_ldap') ?>
622     </td>
624 </tr>
632 <tr valign="top" class="required">
634     <td align="right"><label for="user_attribute"><?php print_string('auth_ldap_user_attribute_key','auth_ldap') ?></label></td>
636     <td>
638     <input name="user_attribute" id="user_attribute" type="text" size="30" value="<?php echo $config->user_attribute?>" />
640     <?php  if (isset($err['user_attribute'])) echo $OUTPUT->error_text($err['user_attribute']); ?>
642     </td>
644     <td>
646     <?php print_string('auth_ldap_user_attribute','auth_ldap') ?>
648     </td>
650 </tr>
654 <tr valign="top" class="required">
656         <td align="right"><label for="memberattribute"><?php print_string('auth_ldap_memberattribute_key','auth_ldap') ?></label></td>
658         <td>
660     <input name="memberattribute" id="memberattribute" type="text" size="30" value="<?php echo $config->memberattribute?>" />
662     <?php  if (isset($err['memberattribute'])) echo $OUTPUT->error_text($err['memberattribute']); ?>
664     </td><td>
666     <?php print_string('auth_ldap_memberattribute','auth_ldap') ?>
668     </td>
670 </tr>
674 <tr valign="top" class="required">
676         <td align="right"><label for="memberattribute_isdn"><?php print_string('auth_ldap_memberattribute_isdn_key','auth_ldap') ?></label></td>
678         <td>
680     <input name="memberattribute_isdn" id="memberattribute_isdn" type="text" size="30" value="<?php echo $config->memberattribute_isdn?>" />
682     <?php  if (isset($err['memberattribute_isdn'])) echo $OUTPUT->error_text($err['memberattribute_isdn']); ?>
684     </td><td>
686     <?php print_string('auth_ldap_memberattribute_isdn','auth_ldap') ?>
688     </td>
690 </tr>
694 <tr valign="top" class="required">
696     <td align="right"><label for="objectclass"><?php print_string('auth_ldap_objectclass_key','auth_ldap') ?></label></td>
698     <td>
700     <input name="objectclass" id="objectclass" type="text" size="30" value="<?php echo $config->objectclass?>" />
702     <?php  if (isset($err['objectclass'])) echo $OUTPUT->error_text($err['objectclass']); ?>
704     </td>
706     <td>
708     <?php print_string('auth_ldap_objectclass','auth_ldap') ?>
710     </td>
712 </tr>
716 <tr>
718    <td colspan="2">
720         <h4><?php print_string('coursecreators') ?> </h4>
722    </td>
724 </tr>
728 <tr valign="top" class="required">
730         <td align="right"><label for="attrcreators"><?php print_string('auth_ldap_attrcreators_key','auth_ldap') ?></label></td>
732         <td>
734     <input name="attrcreators" id="attrcreators" type="text" size="30" value="<?php echo $config->attrcreators?>" />
736     <?php  if (isset($err['attrcreators'])) echo $OUTPUT->error_text($err['attrcreators']); ?>
738     </td><td>
740     <?php print_string('auth_ldap_attrcreators','auth_ldap') ?>
742     </td>
744 </tr>
748 <tr valign="top" class="required">
750         <td align="right"><label for="groupecreators"><?php print_string('auth_ldap_groupecreators_key','auth_ldap') ?></label></td>
752         <td>
754     <input name="groupecreators" id="groupecreators" type="text" size="30" value="<?php echo $config->groupecreators?>" />
756     <?php  if (isset($err['groupecreators'])) echo $OUTPUT->error_text($err['groupecreators']); ?>
758     </td><td>
760     <?php print_string('auth_ldap_groupecreators','auth_ldap') ?>
762     </td>
764 </tr>
768 <tr>
770    <td colspan="2">
772         <h4><?php print_string('auth_sync_script', 'auth') ?> </h4>
774    </td>
776 </tr>
780 <tr valign="top">
782     <td align="right"><label for="menuremoveuser"><?php print_string('auth_remove_user_key','auth') ?></label></td>
784     <td>
786     <?php
788        $deleteopt = array();
790        $deleteopt[AUTH_REMOVEUSER_KEEP] = get_string('auth_remove_keep','auth');
792        $deleteopt[AUTH_REMOVEUSER_SUSPEND] = get_string('auth_remove_suspend','auth');
794        $deleteopt[AUTH_REMOVEUSER_FULLDELETE] = get_string('auth_remove_delete','auth');
796        echo $OUTPUT->select(html_select::make($deleteopt, 'removeuser', $config->removeuser, false));
798     ?>
800     </td>
802     <td>
804     <?php print_string('auth_remove_user','auth') ?>
806     </td>
808 </tr>
810 <?php
814 $help  = get_string('auth_ldapextrafields','auth_ldap');
816 $help .= get_string('auth_updatelocal_expl','auth');
818 $help .= get_string('auth_fieldlock_expl','auth');
820 $help .= get_string('auth_updateremote_expl','auth');
822 $help .= '<hr />';
824 $help .= get_string('auth_updateremote_ldap','auth');
828 print_auth_lock_options('cas', $user_fields, $help, true, true);
832 ?>
833 </table>