From 9f29e45e154fb65a7ba396ba5433ab3141ecd237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mudr=C3=A1k?= Date: Thu, 4 May 2017 10:46:15 +0200 Subject: [PATCH] MDL-58793 auth: Fix invalid access to $this in settings.php files It has never been guaranteed that settings.php would always be included from inside the core\plugininfo\auth::load_settings() scope only. Alternative fix would be to use $plugininfo->name but I think it is better to be explicit here (same as we are explicit with setting names, strings etc). --- auth/cas/settings.php | 2 +- auth/db/settings.php | 2 +- auth/email/settings.php | 2 +- auth/fc/settings.php | 2 +- auth/imap/settings.php | 2 +- auth/ldap/settings.php | 2 +- auth/manual/settings.php | 2 +- auth/nntp/settings.php | 2 +- auth/none/settings.php | 2 +- auth/oauth2/settings.php | 2 +- auth/pam/settings.php | 2 +- auth/pop3/settings.php | 2 +- auth/shibboleth/settings.php | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/auth/cas/settings.php b/auth/cas/settings.php index 961c8d2c0d8..2bd743417b0 100644 --- a/auth/cas/settings.php +++ b/auth/cas/settings.php @@ -264,7 +264,7 @@ if ($ADMIN->fulltree) { } // Display locking / mapping of profile fields. - $authplugin = get_auth_plugin($this->name); + $authplugin = get_auth_plugin('cas'); $help = get_string('auth_ldapextrafields', 'auth_ldap'); $help .= get_string('auth_updatelocal_expl', 'auth'); $help .= get_string('auth_fieldlock_expl', 'auth'); diff --git a/auth/db/settings.php b/auth/db/settings.php index da5622ae298..54f3450eb0a 100644 --- a/auth/db/settings.php +++ b/auth/db/settings.php @@ -135,7 +135,7 @@ if ($ADMIN->fulltree) { new lang_string('auth_dbupdateusers_description', 'auth_db'), 0, $yesno)); // Display locking / mapping of profile fields. - $authplugin = get_auth_plugin($this->name); + $authplugin = get_auth_plugin('db'); display_auth_lock_options($settings, $authplugin->authtype, $authplugin->userfields, get_string('auth_dbextrafields', 'auth_db'), true, true, $authplugin->get_custom_user_profile_fields()); diff --git a/auth/email/settings.php b/auth/email/settings.php index 88d7bc27070..29d2849c469 100644 --- a/auth/email/settings.php +++ b/auth/email/settings.php @@ -40,7 +40,7 @@ if ($ADMIN->fulltree) { new lang_string('auth_emailrecaptcha', 'auth_email'), 0, $options)); // Display locking / mapping of profile fields. - $authplugin = get_auth_plugin($this->name); + $authplugin = get_auth_plugin('email'); display_auth_lock_options($settings, $authplugin->authtype, $authplugin->userfields, get_string('auth_fieldlocks_help', 'auth'), false, false); } diff --git a/auth/fc/settings.php b/auth/fc/settings.php index 6039a647002..ff3aa3f2dac 100644 --- a/auth/fc/settings.php +++ b/auth/fc/settings.php @@ -55,7 +55,7 @@ if ($ADMIN->fulltree) { get_string('changepasswordhelp', 'auth'), '', PARAM_URL)); // Display locking / mapping of profile fields. - $authplugin = get_auth_plugin($this->name); + $authplugin = get_auth_plugin('fc'); display_auth_lock_options($settings, $authplugin->authtype, $authplugin->userfields, get_string('auth_fieldlocks_help', 'auth'), false, false); } diff --git a/auth/imap/settings.php b/auth/imap/settings.php index b2478bd5cbf..fe8e7a13df6 100644 --- a/auth/imap/settings.php +++ b/auth/imap/settings.php @@ -55,7 +55,7 @@ if ($ADMIN->fulltree) { get_string('changepasswordhelp', 'auth'), '', PARAM_URL)); // Display locking / mapping of profile fields. - $authplugin = get_auth_plugin($this->name); + $authplugin = get_auth_plugin('imap'); display_auth_lock_options($settings, $authplugin->authtype, $authplugin->userfields, get_string('auth_fieldlocks_help', 'auth'), false, false); diff --git a/auth/ldap/settings.php b/auth/ldap/settings.php index 85c5f797917..5f6256923b0 100644 --- a/auth/ldap/settings.php +++ b/auth/ldap/settings.php @@ -295,7 +295,7 @@ if ($ADMIN->fulltree) { } // Display locking / mapping of profile fields. - $authplugin = get_auth_plugin($this->name); + $authplugin = get_auth_plugin('ldap'); $help = get_string('auth_ldapextrafields', 'auth_ldap'); $help .= get_string('auth_updatelocal_expl', 'auth'); $help .= get_string('auth_fieldlock_expl', 'auth'); diff --git a/auth/manual/settings.php b/auth/manual/settings.php index cb546e0d45a..95b29b1beb4 100644 --- a/auth/manual/settings.php +++ b/auth/manual/settings.php @@ -72,7 +72,7 @@ if ($ADMIN->fulltree) { new lang_string('expiration_warning_desc', 'auth_manual'), 0, $expirationwarningoptions)); // Display locking / mapping of profile fields. - $authplugin = get_auth_plugin($this->name); + $authplugin = get_auth_plugin('manual'); display_auth_lock_options($settings, $authplugin->authtype, $authplugin->userfields, get_string('auth_fieldlocks_help', 'auth'), false, false); } diff --git a/auth/nntp/settings.php b/auth/nntp/settings.php index d318c688f2e..bf475ee2e95 100644 --- a/auth/nntp/settings.php +++ b/auth/nntp/settings.php @@ -44,7 +44,7 @@ if ($ADMIN->fulltree) { get_string('changepasswordhelp', 'auth'), '', PARAM_URL)); // Display locking / mapping of profile fields. - $authplugin = get_auth_plugin($this->name); + $authplugin = get_auth_plugin('nntp'); display_auth_lock_options($settings, $authplugin->authtype, $authplugin->userfields, get_string('auth_fieldlocks_help', 'auth'), false, false); } diff --git a/auth/none/settings.php b/auth/none/settings.php index 8f7989779eb..28ff93160fb 100644 --- a/auth/none/settings.php +++ b/auth/none/settings.php @@ -31,7 +31,7 @@ if ($ADMIN->fulltree) { new lang_string('auth_nonedescription', 'auth_none'))); // Display locking / mapping of profile fields. - $authplugin = get_auth_plugin($this->name); + $authplugin = get_auth_plugin('none'); display_auth_lock_options($settings, $authplugin->authtype, $authplugin->userfields, get_string('auth_fieldlocks_help', 'auth'), false, false); } diff --git a/auth/oauth2/settings.php b/auth/oauth2/settings.php index 51e15b7ebaa..cecdae54e9e 100644 --- a/auth/oauth2/settings.php +++ b/auth/oauth2/settings.php @@ -29,7 +29,7 @@ if ($ADMIN->fulltree) { $warning = $OUTPUT->notification(get_string('createaccountswarning', 'auth_oauth2'), 'warning'); $settings->add(new admin_setting_heading('auth_oauth2/pluginname', '', $warning)); - $authplugin = get_auth_plugin($this->name); + $authplugin = get_auth_plugin('oauth2'); display_auth_lock_options($settings, $authplugin->authtype, $authplugin->userfields, get_string('auth_fieldlocks_help', 'auth'), false, false); } diff --git a/auth/pam/settings.php b/auth/pam/settings.php index 40ef60a7004..7a053a3f10e 100644 --- a/auth/pam/settings.php +++ b/auth/pam/settings.php @@ -31,7 +31,7 @@ if ($ADMIN->fulltree) { new lang_string('auth_pamdescription', 'auth_pam'))); // Display locking / mapping of profile fields. - $authplugin = get_auth_plugin($this->name); + $authplugin = get_auth_plugin('pam'); display_auth_lock_options($settings, $authplugin->authtype, $authplugin->userfields, get_string('auth_fieldlocks_help', 'auth'), false, false); } diff --git a/auth/pop3/settings.php b/auth/pop3/settings.php index 5454f9502c5..fa9c6a90a80 100644 --- a/auth/pop3/settings.php +++ b/auth/pop3/settings.php @@ -59,7 +59,7 @@ if ($ADMIN->fulltree) { get_string('changepasswordhelp', 'auth'), '', PARAM_URL)); // Display locking / mapping of profile fields. - $authplugin = get_auth_plugin($this->name); + $authplugin = get_auth_plugin('pop3'); display_auth_lock_options($settings, $authplugin->authtype, $authplugin->userfields, get_string('auth_fieldlocks_help', 'auth'), false, false); } diff --git a/auth/shibboleth/settings.php b/auth/shibboleth/settings.php index 94db01fe74e..c9013783bfe 100644 --- a/auth/shibboleth/settings.php +++ b/auth/shibboleth/settings.php @@ -75,7 +75,7 @@ if ($ADMIN->fulltree) { get_string('changepasswordhelp', 'auth'), '', PARAM_URL)); // Display locking / mapping of profile fields. - $authplugin = get_auth_plugin($this->name); + $authplugin = get_auth_plugin('shibboleth'); display_auth_lock_options($settings, $authplugin->authtype, $authplugin->userfields, '', true, false, $authplugin->get_custom_user_profile_fields());