MDL-61899 tool_dataprivacy: Refined patch fixing cibot complains
[moodle.git] / admin / tool / dataprivacy / settings.php
bloba94dfb25ad92d0779d0ecf32a1ce0666677aea9d
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.
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/>.
17 /**
18 * Adds Data privacy-related settings.
20 * @package tool_dataprivacy
21 * @copyright 2018 onwards Jun Pataleta
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25 defined('MOODLE_INTERNAL') || die;
27 if ($hassiteconfig) {
28 $privacysettings = $ADMIN->locate('privacysettings');
30 if ($ADMIN->fulltree) {
31 // Contact data protection officer.
32 $privacysettings->add(new admin_setting_configcheckbox('tool_dataprivacy/contactdataprotectionofficer',
33 new lang_string('contactdataprotectionofficer', 'tool_dataprivacy'),
34 new lang_string('contactdataprotectionofficer_desc', 'tool_dataprivacy'), 1)
37 // Fetch roles that are assignable.
38 $assignableroles = get_assignable_roles(context_system::instance());
40 // Fetch roles that have the capability to manage data requests.
41 $capableroles = get_roles_with_capability('tool/dataprivacy:managedatarequests');
43 // Role(s) that map to the Data Protection Officer role. These are assignable roles with the capability to
44 // manage data requests.
45 $roles = [];
46 foreach ($capableroles as $key => $role) {
47 if (array_key_exists($key, $assignableroles)) {
48 $roles[$key] = $assignableroles[$key];
51 if (!empty($roles)) {
52 $privacysettings->add(new admin_setting_configmultiselect('tool_dataprivacy/dporoles',
53 new lang_string('dporolemapping', 'tool_dataprivacy'),
54 new lang_string('dporolemapping_desc', 'tool_dataprivacy'), null, $roles)
60 // Link that leads to the data requests management page.
61 $ADMIN->add('privacy', new admin_externalpage('datarequests', get_string('datarequests', 'tool_dataprivacy'),
62 new moodle_url('/admin/tool/dataprivacy/datarequests.php'), 'tool/dataprivacy:managedatarequests')
65 // Link that leads to the data registry management page.
66 $ADMIN->add('privacy', new admin_externalpage('dataregistry', get_string('dataregistry', 'tool_dataprivacy'),
67 new moodle_url('/admin/tool/dataprivacy/dataregistry.php'), 'tool/dataprivacy:managedataregistry')
70 // Link that leads to the review page of expired contexts that are up for deletion.
71 $ADMIN->add('privacy', new admin_externalpage('datadeletion', get_string('datadeletion', 'tool_dataprivacy'),
72 new moodle_url('/admin/tool/dataprivacy/datadeletion.php'), 'tool/dataprivacy:managedataregistry')