1 |
efrain |
1 |
<?php
|
|
|
2 |
// This file is part of Moodle - http://moodle.org/
|
|
|
3 |
//
|
|
|
4 |
// Moodle is free software: you can redistribute it and/or modify
|
|
|
5 |
// it under the terms of the GNU General Public License as published by
|
|
|
6 |
// the Free Software Foundation, either version 3 of the License, or
|
|
|
7 |
// (at your option) any later version.
|
|
|
8 |
//
|
|
|
9 |
// Moodle is distributed in the hope that it will be useful,
|
|
|
10 |
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
11 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
12 |
// GNU General Public License for more details.
|
|
|
13 |
//
|
|
|
14 |
// You should have received a copy of the GNU General Public License
|
|
|
15 |
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
|
|
16 |
|
|
|
17 |
/**
|
|
|
18 |
* Settings
|
|
|
19 |
*
|
|
|
20 |
* @package tool_mfa
|
|
|
21 |
* @author Mikhail Golenkov <golenkovm@gmail.com>
|
|
|
22 |
* @copyright Catalyst IT
|
|
|
23 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
24 |
*/
|
|
|
25 |
|
|
|
26 |
defined('MOODLE_INTERNAL') || die();
|
|
|
27 |
|
|
|
28 |
if ($hassiteconfig) {
|
|
|
29 |
$ADMIN->add('tools', new admin_category('toolmfafolder', new lang_string('pluginname', 'tool_mfa'), false));
|
|
|
30 |
$ADMIN->add('toolmfafolder', new admin_externalpage('tool_mfa_resetfactor',
|
|
|
31 |
get_string('resetfactor', 'tool_mfa'),
|
|
|
32 |
new moodle_url('/admin/tool/mfa/reset_factor.php')));
|
|
|
33 |
|
|
|
34 |
$settings = new admin_settingpage('managemfa', new lang_string('mfasettings', 'tool_mfa'));
|
|
|
35 |
$settings->add(new \tool_mfa\local\admin_setting_managemfa());
|
|
|
36 |
|
|
|
37 |
$heading = new lang_string('settings:general', 'tool_mfa');
|
|
|
38 |
$settings->add(new admin_setting_heading('tool_mfa/settings', $heading, ''));
|
|
|
39 |
|
|
|
40 |
$name = new lang_string('settings:enabled', 'tool_mfa');
|
|
|
41 |
$settings->add(new admin_setting_configcheckbox('tool_mfa/enabled', $name, '', false));
|
|
|
42 |
|
|
|
43 |
$name = new lang_string('settings:lockout', 'tool_mfa');
|
|
|
44 |
$description = new lang_string('settings:lockout_help', 'tool_mfa');
|
|
|
45 |
$settings->add(new admin_setting_configtext('tool_mfa/lockout', $name, $description, 10, PARAM_INT));
|
|
|
46 |
|
|
|
47 |
$name = new lang_string('settings:debugmode', 'tool_mfa');
|
|
|
48 |
$description = new lang_string('settings:debugmode_help', 'tool_mfa');
|
|
|
49 |
$settings->add(new admin_setting_configcheckbox('tool_mfa/debugmode', $name, $description, false));
|
|
|
50 |
|
|
|
51 |
$name = new lang_string('settings:redir_exclusions', 'tool_mfa');
|
|
|
52 |
$description = new lang_string('settings:redir_exclusions_help', 'tool_mfa');
|
|
|
53 |
$settings->add(new admin_setting_configtextarea('tool_mfa/redir_exclusions', $name, $description, ''));
|
|
|
54 |
|
|
|
55 |
$name = new lang_string('settings:guidancecheck', 'tool_mfa');
|
|
|
56 |
$description = new lang_string('settings:guidancecheck_help', 'tool_mfa');
|
|
|
57 |
$settings->add(new admin_setting_configcheckbox('tool_mfa/guidance', $name, $description, false));
|
|
|
58 |
|
|
|
59 |
$name = new lang_string('settings:guidancepage', 'tool_mfa');
|
|
|
60 |
$description = new lang_string('settings:guidancepage_help', 'tool_mfa');
|
|
|
61 |
$settings->add(new admin_setting_confightmleditor('tool_mfa/guidancecontent', $name, $description, '', PARAM_RAW));
|
|
|
62 |
|
|
|
63 |
$name = new lang_string('settings:guidancefiles', 'tool_mfa');
|
|
|
64 |
$description = new lang_string('settings:guidancefiles_help', 'tool_mfa');
|
|
|
65 |
$settings->add(new admin_setting_configstoredfile('tool_mfa/guidancefiles', $name, $description, 'guidance', 0, [
|
|
|
66 |
'maxfiles' => -1,
|
|
|
67 |
]));
|
|
|
68 |
|
|
|
69 |
$ADMIN->add('toolmfafolder', $settings);
|
|
|
70 |
|
|
|
71 |
foreach (core_plugin_manager::instance()->get_plugins_of_type('factor') as $plugin) {
|
|
|
72 |
$plugin->load_settings($ADMIN, 'toolmfafolder', $hassiteconfig);
|
|
|
73 |
}
|
|
|
74 |
|
|
|
75 |
$ADMIN->add('reports', new admin_category('toolmfareports', get_string('mfareports', 'tool_mfa')));
|
|
|
76 |
|
|
|
77 |
$ADMIN->add('toolmfareports',
|
|
|
78 |
new admin_externalpage('factorreport', get_string('factorreport', 'tool_mfa'),
|
|
|
79 |
new moodle_url('/admin/tool/mfa/factor_report.php')));
|
|
|
80 |
}
|