Permalink
Browse files

auth/cas MDL-16168 CAS crashes if no LDAP is set up

Don't crash if no LDAP server is configured. This also means that
user details need to be retrieved/updated via other means.
  • Loading branch information...
1 parent ae0a52f commit 9a688af4ee06a6386a8f59ec8225b711b5c8caef @iarenaza iarenaza committed Sep 15, 2010
Showing with 8 additions and 1 deletion.
  1. +7 −0 auth/cas/auth.php
  2. +1 −1 lang/en_utf8/auth.php
View
@@ -370,6 +370,13 @@ function ldap_getdefaults() {
* @return mixed array with no magic quotes or false on error
*/
function get_userinfo($username) {
+ // No LDAP servers configured, so user info has to be provided
+ // via other methods (CSV file, manually, etc.). Return empty
+ // array so existing user info is not lost.
+ if (empty($this->config->host_url)) {
+ return array();
+ }
+
$textlib = textlib_get_instance();
$extusername = $textlib->convert(stripslashes($username), 'utf-8', $this->config->ldapencoding);
$ldapconnection = $this->ldap_connect();
View
@@ -187,7 +187,7 @@
$string['auth_ldap_gracelogins_desc'] = 'Enable LDAP gracelogin support. After password has expired user can login until gracelogin count is 0. Enabling this setting displays grace login message if password is expired.';
$string['auth_ldap_groupecreators'] = 'List of groups or contexts whose members are allowed to create groups. Separate multiple groups with \';\'. Usually something like \'cn=teachers,ou=staff,o=myorg\'';
$string['auth_ldap_groupecreators_key'] = 'Group creators';
-$string['auth_ldap_host_url'] = 'Specify LDAP host in URL-form like \'ldap://ldap.myorg.com/\' or \'ldaps://ldap.myorg.com/\' Separate multipleservers with \';\' to get failover support.';
+$string['auth_ldap_host_url'] = 'Specify LDAP host in URL-form like \'ldap://ldap.myorg.com/\' or \'ldaps://ldap.myorg.com/\' Separate multipleservers with \';\' to get failover support.<br/><br/>NOTE: If you do not set this value Moodle will not try to get/update user information from LDAP, but the locking of the fields you specify below will be respected.';
$string['auth_ldap_ldap_encoding'] = 'Specify encoding used by LDAP server. Most probably utf-8, MS AD v2 uses default platform encoding such as cp1252, cp1250, etc.';
$string['auth_ldap_login_settings'] = 'Login settings';
$string['auth_ldap_memberattribute'] = 'Optional: Overrides user member attribute, when users belongs to a group. Usually \'member\'';

0 comments on commit 9a688af

Please sign in to comment.