From 2ba609cc8c45fdf290f90195b2bd7c5a7076235d Mon Sep 17 00:00:00 2001 From: martinlanghoff Date: Wed, 1 Jun 2005 06:01:29 +0000 Subject: [PATCH] config_plugin work * lang updates and lang-related fixes * auth/db uses the new convention --- admin/auth.php | 2 +- auth/db/config.html | 89 +-------------------------------------------- auth/db/lib.php | 7 +++- lang/en/auth.php | 19 +++++++--- 4 files changed, 20 insertions(+), 97 deletions(-) diff --git a/admin/auth.php b/admin/auth.php index f46a67db6f1..8b1c98fe402 100644 --- a/admin/auth.php +++ b/admin/auth.php @@ -226,7 +226,7 @@ function print_auth_lock_options ($auth, $user_fields, $helptext, $retrieveopts, 'unlockedifempty' => get_string('unlockedifempty', 'auth'), 'locked' => get_string('locked', 'auth')); $updatelocaloptions = array('oncreate' => get_string('update_oncreate', 'auth'), - 'onlogin' => get_string('update_onogin', 'auth')); + 'onlogin' => get_string('update_onlogin', 'auth')); $updateextoptions = array('0' => get_string('update_never', 'auth'), '1' => get_string('update_onupdate', 'auth')); diff --git a/auth/db/config.html b/auth/db/config.html index 888fd744840..0b960d2ec07 100644 --- a/auth/db/config.html +++ b/auth/db/config.html @@ -135,94 +135,7 @@ - - - : - - - - - - - - - - : - - - - - - - : - - - - - - - 1: - - - - - - - 2: - - - - - - - : - - - - - - - : - - - - - - - : - - - - - - - : - - - - - - - : - - - - - - - : - - - - - - - : - - - - - + : diff --git a/auth/db/lib.php b/auth/db/lib.php index b085d5cb429..73afd050c42 100644 --- a/auth/db/lib.php +++ b/auth/db/lib.php @@ -58,6 +58,9 @@ function auth_get_userinfo($username){ $config = (array) $CFG; + $pcfg = get_config('auth/db'); + $pcfg = (array) $pcfg; + ADOLoadCode($CFG->auth_dbtype); $authdb = &ADONewConnection(); $authdb->PConnect($CFG->auth_dbhost,$CFG->auth_dbuser,$CFG->auth_dbpass,$CFG->auth_dbname); @@ -69,8 +72,8 @@ function auth_get_userinfo($username){ $result = array(); foreach ($fields as $field) { - if ($config["auth_user_$field"]) { - if ($rs = $authdb->Execute("SELECT ".$config["auth_user_$field"]." FROM $CFG->auth_dbtable + if ($pcfg["field_map_$field"]) { + if ($rs = $authdb->Execute("SELECT ".$pcfg["field_map_$field"]." FROM $CFG->auth_dbtable WHERE $CFG->auth_dbfielduser = '$username'")) { if ( $rs->RecordCount() == 1 ) { $result["$field"] = $rs->fields[0]; diff --git a/lang/en/auth.php b/lang/en/auth.php index 79014f82bf3..9f04dd7d2cf 100644 --- a/lang/en/auth.php +++ b/lang/en/auth.php @@ -31,8 +31,8 @@ $string['auth_dbtable'] = 'Name of the table in the database'; $string['auth_dbtitle'] = 'Use an external database'; $string['auth_dbtype'] = 'The database type (See the ADOdb documentation for details)'; $string['auth_dbuser'] = 'Username with read access to the database'; -$string['auth_editlock'] = 'Lock value'; -$string['auth_editlock_expl'] = '

Lock value: If enabled, will prevent Moodle users and admins from editing the field directly. Use this option if you are maintaining this data in the external auth system.

'; +$string['auth_fieldlock'] = 'Lock value'; +$string['auth_fieldlock_expl'] = '

Lock value: If enabled, will prevent Moodle users and admins from editing the field directly. Use this option if you are maintaining this data in the external auth system.

'; $string['auth_emaildescription'] = 'Email confirmation is the default authentication method. When the user signs up, choosing their own new username and password, a confirmation email is sent to the user\'s email address. This email contains a secure link to a page where the user can confirm their account. Future logins just check the username and password against the stored values in the Moodle database.'; $string['auth_emailtitle'] = 'Email-based authentication'; $string['auth_fccreators'] = 'List of groups whose members are allowed to create new courses. Separate multiple groups with \';\'. Names must be spelled exactly as on FirstClass server. System is case-sensitive.'; @@ -113,10 +113,10 @@ $string['auth_shib_convert_data'] = 'Data modification API'; $string['auth_shib_convert_data_description'] = 'You can use this API to further modify the data provided by Shibboleth. Read the README for further instructions.'; $string['auth_shib_instructions_help'] = 'Here you should provide custom instructions for your users to explain Shibboleth. It will be shown on the login page in the instructions section. It should include a link to a Shibboleth-protected resource that redirects users to \"$a\" so that Shibboleth users can login in Moodle. If you leave it blank, then standard instructions will be used (not Shibboleth-specific)'; $string['auth_shib_convert_data_warning'] = 'The file does not exist or is not readable by the webserver process!'; -$string['auth_updatelocal'] = 'Update local data'; -$string['auth_updatelocal_expl'] = '

Update local data: If enabled, the field will be updated (from external auth) every time the user logs in or there is a user synchronization. Fields set to update locally should be locked.

'; -$string['auth_updateremote'] = 'Update external data'; -$string['auth_updateremote_expl'] = '

Update external data: If enabled, the external auth will be updated when the user record is updated. Fields should be unlocked to allow edits.

'; +$string['auth_updatelocal'] = 'Update local'; +$string['auth_updatelocal_expl'] = '

Update local: If enabled, the field will be updated (from external auth) every time the user logs in or there is a user synchronization. Fields set to update locally should be locked.

'; +$string['auth_updateremote'] = 'Update external'; +$string['auth_updateremote_expl'] = '

Update external: If enabled, the external auth will be updated when the user record is updated. Fields should be unlocked to allow edits.

'; $string['auth_updateremote_ldap'] = '

Note: Updating external LDAP data requires that you set binddn and bindpw to a bind-user with editing privileges to all the user records. It currently does not preserve multi-valued attributes, and will remove extra values on update.

'; $string['auth_user_create'] = 'Enable user creation'; $string['auth_user_creation'] = 'New (anonymous) users can create user accounts on the external authentication source and confirmed via email. If you enable this , remember to also configure module-specific options for user creation.'; @@ -137,5 +137,12 @@ $string['showguestlogin'] = 'You can hide or show the guest login button on the $string['stdchangepassword'] = 'Use standard Change Password Page'; $string['stdchangepassword_expl'] = 'If the external authentication system allows password changes through Moodle, switch this to Yes. This setting overrides \'Change Password URL\'.'; $string['stdchangepassword_explldap'] = 'NOTE: It is recommended that you use LDAP over an SSL encrypted tunnel (ldaps://) if the LDAP server is remote.'; +$string['update_oncreate'] = 'On creation'; +$string['update_onlogin'] = 'On every login'; +$string['update_onupdate'] = 'On update'; +$string['update_never'] = 'Never'; +$string['unlocked'] = 'Unlocked'; +$string['unlockedifempty'] = 'Unlocked if empty'; +$string['locked'] = 'Locked'; ?>