MDL-58478 oauth2: Use real admin settings

This is an upgrade to real admin settings to comply with MDL-12689
This commit is contained in:
Damyon Wiese 2017-04-04 14:37:13 +08:00
parent ab8aa88214
commit 46d5582ec9
3 changed files with 35 additions and 28 deletions

View File

@ -151,22 +151,6 @@ class auth extends \auth_plugin_base {
return true;
}
/**
* Prints a form for configuring this authentication plugin.
*
* This function is called from admin/auth.php, and outputs a full page with
* a form for configuring this plugin.
*
* @param stdClass $config
* @param string $err
* @param array $userfields
*/
public function config_form($config, $err, $userfields) {
include(__DIR__ . "/../config.html");
return;
}
/**
* Return the userinfo from the oauth handshake. Will only be valid
* for the logged in user.

View File

@ -1,12 +0,0 @@
<!-- No config needed -->
<div style="text-align: center"><?php print_string('plugindescription', 'auth_oauth2'); ?></div>
<div class="alert alert-warning m-y-2" style="text-align: center"><?php print_string('createaccountswarning', 'auth_oauth2'); ?></div>
<table cellspacing="0" cellpadding="5" border="0">
<?php
print_auth_lock_options($this->authtype, $userfields, get_string('auth_fieldlocks_help', 'auth'), false, false);
?>
</table>

35
auth/oauth2/settings.php Normal file
View File

@ -0,0 +1,35 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Admin settings and defaults.
*
* @package auth_oauth2
* @copyright 2017 Damyon Wiese
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
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);
display_auth_lock_options($settings, $authplugin->authtype, $authplugin->userfields,
get_string('auth_fieldlocks_help', 'auth'), false, false);
}