| Línea 23... |
Línea 23... |
| 23 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
23 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
| 24 |
*/
|
24 |
*/
|
| Línea 25... |
Línea 25... |
| 25 |
|
25 |
|
| Línea -... |
Línea 26... |
| - |
|
26 |
defined('MOODLE_INTERNAL') || die();
|
| - |
|
27 |
|
| - |
|
28 |
if ($ADMIN->fulltree) {
|
| - |
|
29 |
$settings->add(new admin_setting_heading('factor_role/description', '',
|
| - |
|
30 |
new lang_string('settings:description', 'factor_role')));
|
| 26 |
defined('MOODLE_INTERNAL') || die();
|
31 |
$settings->add(new admin_setting_heading('factor_role/settings', new lang_string('settings', 'moodle'), ''));
|
| 27 |
|
32 |
|
| 28 |
$enabled = new admin_setting_configcheckbox('factor_role/enabled',
|
33 |
$enabled = new admin_setting_configcheckbox('factor_role/enabled',
|
| 29 |
new lang_string('settings:enablefactor', 'tool_mfa'),
|
34 |
new lang_string('settings:enablefactor', 'tool_mfa'),
|
| 30 |
new lang_string('settings:enablefactor_help', 'tool_mfa'), 0);
|
35 |
new lang_string('settings:enablefactor_help', 'tool_mfa'), 0);
|
| 31 |
$enabled->set_updatedcallback(function () {
|
36 |
$enabled->set_updatedcallback(function () {
|
| 32 |
\tool_mfa\manager::do_factor_action('role', get_config('factor_role', 'enabled') ? 'enable' : 'disable');
|
37 |
\tool_mfa\manager::do_factor_action('role', get_config('factor_role', 'enabled') ? 'enable' : 'disable');
|
| 33 |
});
|
38 |
});
|
| 34 |
$settings->add($enabled);
|
39 |
$settings->add($enabled);
|
| 35 |
|
40 |
|
| 36 |
$settings->add(new admin_setting_configtext('factor_role/weight',
|
41 |
$settings->add(new admin_setting_configtext('factor_role/weight',
|
| 37 |
new lang_string('settings:weight', 'tool_mfa'),
|
- |
|
| 38 |
new lang_string('settings:weight_help', 'tool_mfa'), 100, PARAM_INT));
|
- |
|
| 39 |
|
- |
|
| 40 |
$choices = ['admin' => get_string('administrator')];
|
- |
|
| 41 |
$roles = get_all_roles();
|
- |
|
| 42 |
foreach ($roles as $role) {
|
- |
|
| Línea -... |
Línea 42... |
| - |
|
42 |
new lang_string('settings:weight', 'tool_mfa'),
|
| - |
|
43 |
new lang_string('settings:weight_help', 'tool_mfa'), 100, PARAM_INT));
|
| - |
|
44 |
|
| - |
|
45 |
$choices = ['admin' => get_string('administrator')];
|
| - |
|
46 |
$roles = get_all_roles();
|
| - |
|
47 |
foreach ($roles as $role) {
|
| 43 |
$choices[$role->id] = role_get_name($role);
|
48 |
$choices[$role->id] = role_get_name($role);
|
| 44 |
}
|
49 |
}
|
| 45 |
|
50 |
|
| - |
|
51 |
$settings->add(new admin_setting_configmultiselect('factor_role/roles',
|