MDL-56595 tool_usertours: set page params when configuring tours/steps.
[moodle.git] / admin / tool / dataprivacy / settings.php
CommitLineData
5efc1f9e
DM
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 * Adds Data privacy-related settings.
19 *
20 * @package tool_dataprivacy
21 * @copyright 2018 onwards Jun Pataleta
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23 */
24
25defined('MOODLE_INTERNAL') || die;
26
27if ($hassiteconfig) {
28 $privacysettings = $ADMIN->locate('privacysettings');
29
30 if ($ADMIN->fulltree) {
ba5b59c0 31 // Contact data protection officer. Disabled by default.
5efc1f9e
DM
32 $privacysettings->add(new admin_setting_configcheckbox('tool_dataprivacy/contactdataprotectionofficer',
33 new lang_string('contactdataprotectionofficer', 'tool_dataprivacy'),
ba5b59c0 34 new lang_string('contactdataprotectionofficer_desc', 'tool_dataprivacy'), 0)
5efc1f9e
DM
35 );
36
12c1e8b2
JP
37 $privacysettings->add(new admin_setting_configcheckbox('tool_dataprivacy/automaticdataexportapproval',
38 new lang_string('automaticdataexportapproval', 'tool_dataprivacy'),
39 new lang_string('automaticdataexportapproval_desc', 'tool_dataprivacy'), 0)
40 );
41
42 $privacysettings->add(new admin_setting_configcheckbox('tool_dataprivacy/automaticdatadeletionapproval',
43 new lang_string('automaticdatadeletionapproval', 'tool_dataprivacy'),
44 new lang_string('automaticdatadeletionapproval_desc', 'tool_dataprivacy'), 0)
45 );
46
b4ecfa38
MG
47 // Automatically create delete data request for users upon user deletion.
48 // Automatically create delete data request for pre-existing deleted users.
49 // Enabled by default.
50 $privacysettings->add(new admin_setting_configcheckbox('tool_dataprivacy/automaticdeletionrequests',
51 new lang_string('automaticdeletionrequests', 'tool_dataprivacy'),
52 new lang_string('automaticdeletionrequests_desc', 'tool_dataprivacy'), 1)
53 );
54
693f690c
MH
55 // Set days approved data requests will be accessible. 1 week default.
56 $privacysettings->add(new admin_setting_configduration('tool_dataprivacy/privacyrequestexpiry',
57 new lang_string('privacyrequestexpiry', 'tool_dataprivacy'),
58 new lang_string('privacyrequestexpiry_desc', 'tool_dataprivacy'),
59 WEEKSECS, 1));
60
5efc1f9e
DM
61 // Fetch roles that are assignable.
62 $assignableroles = get_assignable_roles(context_system::instance());
63
64 // Fetch roles that have the capability to manage data requests.
65 $capableroles = get_roles_with_capability('tool/dataprivacy:managedatarequests');
66
a8a69050
DM
67 // Role(s) that map to the Data Protection Officer role. These are assignable roles with the capability to
68 // manage data requests.
5efc1f9e
DM
69 $roles = [];
70 foreach ($capableroles as $key => $role) {
71 if (array_key_exists($key, $assignableroles)) {
72 $roles[$key] = $assignableroles[$key];
73 }
74 }
75 if (!empty($roles)) {
46cb408e 76 $privacysettings->add(new admin_setting_configmulticheckbox('tool_dataprivacy/dporoles',
5efc1f9e
DM
77 new lang_string('dporolemapping', 'tool_dataprivacy'),
78 new lang_string('dporolemapping_desc', 'tool_dataprivacy'), null, $roles)
79 );
80 }
65f77d31
AN
81
82 // When calculating user expiry, should courses which have no end date be considered.
83 $privacysettings->add(new admin_setting_configcheckbox('tool_dataprivacy/requireallenddatesforuserdeletion',
84 new lang_string('requireallenddatesforuserdeletion', 'tool_dataprivacy'),
85 new lang_string('requireallenddatesforuserdeletion_desc', 'tool_dataprivacy'),
751b5e8b 86 1));
abc469dd
LB
87
88 // Whether the data retention summary should be shown in the page footer and in the user profile page.
89 $privacysettings->add(new admin_setting_configcheckbox('tool_dataprivacy/showdataretentionsummary',
90 new lang_string('showdataretentionsummary', 'tool_dataprivacy'),
91 new lang_string('showdataretentionsummary_desc', 'tool_dataprivacy'),
92 1));
5efc1f9e
DM
93 }
94}
95
161a5c8a
MH
96// Restrict config links to the DPO.
97if (tool_dataprivacy\api::is_site_dpo($USER->id)) {
98 // Link that leads to the data requests management page.
99 $ADMIN->add('privacy', new admin_externalpage('datarequests', get_string('datarequests', 'tool_dataprivacy'),
100 new moodle_url('/admin/tool/dataprivacy/datarequests.php'), 'tool/dataprivacy:managedatarequests')
101 );
5efc1f9e 102
161a5c8a
MH
103 // Link that leads to the data registry management page.
104 $ADMIN->add('privacy', new admin_externalpage('dataregistry', get_string('dataregistry', 'tool_dataprivacy'),
105 new moodle_url('/admin/tool/dataprivacy/dataregistry.php'), 'tool/dataprivacy:managedataregistry')
106 );
5efc1f9e 107
161a5c8a
MH
108 // Link that leads to the review page of expired contexts that are up for deletion.
109 $ADMIN->add('privacy', new admin_externalpage('datadeletion', get_string('datadeletion', 'tool_dataprivacy'),
110 new moodle_url('/admin/tool/dataprivacy/datadeletion.php'), 'tool/dataprivacy:managedataregistry')
111 );
d6ff9edd 112
161a5c8a
MH
113 // Link that leads to the other data registry management page.
114 $ADMIN->add('privacy', new admin_externalpage('pluginregistry', get_string('pluginregistry', 'tool_dataprivacy'),
115 new moodle_url('/admin/tool/dataprivacy/pluginregistry.php'), 'tool/dataprivacy:managedataregistry')
116 );
117}