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

index 34f5364..1190c23 100644 (file)
@@ -47,5 +47,13 @@ function xmldb_auth_cas_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_cas', 'memberattribute_isdn')), 'auth_cas');
+
+        upgrade_plugin_savepoint(true, 2021052501, 'auth', 'cas');
+    }
+
     return true;
 }
index 5434984..50f6733 100644 (file)
@@ -239,9 +239,9 @@ if ($ADMIN->fulltree) {
                 get_string('auth_ldap_memberattribute', 'auth_ldap'), '', PARAM_RAW));
 
         // Member attribute uses dn.
-        $settings->add(new admin_setting_configtext('auth_cas/memberattribute_isdn',
+        $settings->add(new admin_setting_configselect('auth_cas/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_cas/objectclass',
index eb0c3b9..4e2fbac 100644 (file)
@@ -26,7 +26,7 @@
 
 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_cas';        // Full name of the plugin (used for diagnostics)