MDL-69492 auth_ldap: normalise member distinguished name config.
authorPaul Holden <paulh@moodle.com>
Mon, 17 Aug 2020 19:31:27 +0000 (20:31 +0100)
committerPaul Holden <paulh@moodle.com>
Fri, 4 Sep 2020 07:25:50 +0000 (08:25 +0100)
auth/ldap/db/upgrade.php
auth/ldap/lang/en/auth_ldap.php
auth/ldap/settings.php
auth/ldap/version.php

index e40963a..41f9db5 100644 (file)
@@ -47,5 +47,13 @@ function xmldb_auth_ldap_upgrade($oldversion) {
     // Automatically generated Moodle v3.9.0 release upgrade line.
     // Put any upgrade step following this.
 
+    if ($oldversion < 2021052501) {
+        // Normalize the memberattribute_isdn plugin config.
+        set_config('memberattribute_isdn',
+            !empty(get_config('auth_ldap', 'memberattribute_isdn')), 'auth_ldap');
+
+        upgrade_plugin_savepoint(true, 2021052501, 'auth', 'ldap');
+    }
+
     return true;
 }
index da0f7e9..5ed9e14 100644 (file)
@@ -57,7 +57,7 @@ $string['auth_ldap_ldap_encoding'] = 'Encoding used by the LDAP server, most lik
 $string['auth_ldap_ldap_encoding_key'] = 'LDAP encoding';
 $string['auth_ldap_login_settings'] = 'Login settings';
 $string['auth_ldap_memberattribute'] = 'Optional: Overrides user member attribute, when users belongs to a group. Usually \'member\'';
-$string['auth_ldap_memberattribute_isdn'] = 'Optional: Overrides handling of member attribute values, either 0 or 1';
+$string['auth_ldap_memberattribute_isdn'] = 'Overrides handling of member attribute values';
 $string['auth_ldap_memberattribute_isdn_key'] = 'Member attribute uses dn';
 $string['auth_ldap_memberattribute_key'] = 'Member attribute';
 $string['auth_ldap_noconnect'] = 'LDAP-module cannot connect to server: {$a}';
index f9bc8d9..d72aed7 100644 (file)
@@ -142,9 +142,9 @@ if ($ADMIN->fulltree) {
                 get_string('auth_ldap_memberattribute', 'auth_ldap'), '', PARAM_RAW));
 
         // Member attribute uses dn.
-        $settings->add(new admin_setting_configtext('auth_ldap/memberattribute_isdn',
+        $settings->add(new admin_setting_configselect('auth_ldap/memberattribute_isdn',
                 get_string('auth_ldap_memberattribute_isdn_key', 'auth_ldap'),
-                get_string('auth_ldap_memberattribute_isdn', 'auth_ldap'), '', PARAM_RAW));
+                get_string('auth_ldap_memberattribute_isdn', 'auth_ldap'), 0, $yesno));
 
         // Object class.
         $settings->add(new admin_setting_configtext('auth_ldap/objectclass',
index 592dff5..f2a5a7d 100644 (file)
@@ -25,6 +25,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2021052500;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->version   = 2021052501;        // The current plugin version (Date: YYYYMMDDXX)
 $plugin->requires  = 2021052500;        // Requires this Moodle version
 $plugin->component = 'auth_ldap';       // Full name of the plugin (used for diagnostics)