Skip to content

Commit ef9428e

Browse files
author
David Monllao
committed
Merge branch 'MDL-62425-33' of git://github.com/andrewnicols/moodle into MOODLE_33_STABLE
2 parents ccc3f70 + 974a90e commit ef9428e

File tree

3 files changed

+165
-1
lines changed

3 files changed

+165
-1
lines changed

lang/en/moodle.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1501,6 +1501,32 @@
15011501
$string['previouslyselectedusers'] = 'Previously selected users not matching \'{$a}\'';
15021502
$string['previoussection'] = 'Previous section';
15031503
$string['primaryadminsetup'] = 'Setup administrator account';
1504+
$string['privacy:metadata:config_log'] = 'The log of configuration changes.';
1505+
$string['privacy:metadata:config_log:name'] = 'The name of the setting changes.';
1506+
$string['privacy:metadata:config_log:oldvalue'] = 'The previous value for this setting.';
1507+
$string['privacy:metadata:config_log:plugin'] = 'The plugin modified.';
1508+
$string['privacy:metadata:config_log:timemodified'] = 'The time that the change was made.';
1509+
$string['privacy:metadata:config_log:userid'] = 'The user who made the change.';
1510+
$string['privacy:metadata:config_log:value'] = 'The new value for this setting.';
1511+
$string['privacy:metadata:events_queue'] = 'The queue of user events waiting to be processed.';
1512+
$string['privacy:metadata:events_queue:eventdata'] = 'The data stored in the event.';
1513+
$string['privacy:metadata:events_queue:stackdump'] = 'Any stacktrace associated with this event.';
1514+
$string['privacy:metadata:events_queue:timecreated'] = 'The time that this event was created.';
1515+
$string['privacy:metadata:events_queue:userid'] = 'The userid associated with this event.';
1516+
$string['privacy:metadata:task_adhoc'] = 'The status of adhoc tasks.';
1517+
$string['privacy:metadata:task_adhoc:component'] = 'The component owning the task.';
1518+
$string['privacy:metadata:task_adhoc:nextruntime'] = 'The earliest time to run this task.';
1519+
$string['privacy:metadata:task_adhoc:userid'] = 'The user to run the task as.';
1520+
$string['privacy:metadata:upgrade_log'] = 'The upgrade log.';
1521+
$string['privacy:metadata:upgrade_log:backtrace'] = 'Any backtrace associated with this upgrade step.';
1522+
$string['privacy:metadata:upgrade_log:details'] = 'Extra information relating to the upgrade.';
1523+
$string['privacy:metadata:upgrade_log:info'] = 'The main information for this upgrade step.';
1524+
$string['privacy:metadata:upgrade_log:plugin'] = 'The plugin which was upgraded.';
1525+
$string['privacy:metadata:upgrade_log:targetversion'] = 'The new version to upgrade to.';
1526+
$string['privacy:metadata:upgrade_log:timemodified'] = 'The time that the upgrade took place.';
1527+
$string['privacy:metadata:upgrade_log:type'] = 'The type of log entry.';
1528+
$string['privacy:metadata:upgrade_log:userid'] = 'The user who ran the upgrade.';
1529+
$string['privacy:metadata:upgrade_log:version'] = 'The old version of the plugin.';
15041530
$string['privatefiles'] = 'Private files';
15051531
$string['privatefilesmanage'] = 'Manage private files';
15061532
$string['private_files_handler'] = 'Store attachments to an e-mail in the user\'s private files storage space.';

lib/classes/privacy/provider.php

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
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+
* Privacy class for requesting user data.
19+
*
20+
* @package core
21+
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
22+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23+
*/
24+
25+
namespace core\privacy;
26+
27+
defined('MOODLE_INTERNAL') || die();
28+
29+
use \core_privacy\local\metadata\collection;
30+
use \core_privacy\local\request\contextlist;
31+
use \core_privacy\local\request\approved_contextlist;
32+
33+
/**
34+
* Privacy class for requesting user data.
35+
*
36+
* @package core
37+
* @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
38+
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
39+
*/
40+
class provider implements \core_privacy\local\metadata\provider, \core_privacy\local\request\subsystem\provider {
41+
42+
/**
43+
* Returns information about the user data stored in this component.
44+
*
45+
* @param collection $collection A list of information about this component
46+
* @return collection The collection object filled out with information about this component.
47+
*/
48+
public static function get_metadata(collection $collection) {
49+
// These tables are really data about site configuration and not user data.
50+
51+
// The config_log includes information about which user performed a configuration change.
52+
// The value and oldvalue may contain sensitive information such as accounts for service passwords..
53+
// This is not considered to be user data.
54+
$collection->add_database_table('config_log', [
55+
'userid' => 'privacy:metadata:config_log:userid',
56+
'timemodified' => 'privacy:metadata:config_log:timemodified',
57+
'plugin' => 'privacy:metadata:config_log:plugin',
58+
'name' => 'privacy:metadata:config_log:name',
59+
'value' => 'privacy:metadata:config_log:value',
60+
'oldvalue' => 'privacy:metadata:config_log:oldvalue',
61+
], 'privacy:metadata:config_log');
62+
63+
// The upgrade_log includes information about which user performed an upgrade.
64+
// This is not considered to be user data.
65+
$collection->add_database_table('upgrade_log', [
66+
'type' => 'privacy:metadata:upgrade_log:type',
67+
'plugin' => 'privacy:metadata:upgrade_log:plugin',
68+
'version' => 'privacy:metadata:upgrade_log:version',
69+
'targetversion' => 'privacy:metadata:upgrade_log:targetversion',
70+
'info' => 'privacy:metadata:upgrade_log:info',
71+
'details' => 'privacy:metadata:upgrade_log:details',
72+
'backtrace' => 'privacy:metadata:upgrade_log:backtrace',
73+
'userid' => 'privacy:metadata:upgrade_log:userid',
74+
'timemodified' => 'privacy:metadata:upgrade_log:timemodified',
75+
], 'privacy:metadata:upgrade_log');
76+
77+
// The task_adhoc includes information about pending adhoc tasks, some of which may be run as a user.
78+
// These are removed as the task completes.
79+
$collection->add_database_table('task_adhoc', [
80+
'component' => 'privacy:metadata:task_adhoc:component',
81+
'nextruntime' => 'privacy:metadata:task_adhoc:nextruntime',
82+
'userid' => 'privacy:metadata:task_adhoc:userid',
83+
], 'privacy:metadata:task_adhoc');
84+
85+
// The events_queue includes information about pending events tasks.
86+
// These are stored for short periods whilst being processed into other locations.
87+
$collection->add_database_table('events_queue', [
88+
'eventdata' => 'privacy:metadata:events_queue:eventdata',
89+
'stackdump' => 'privacy:metadata:events_queue:stackdump',
90+
'userid' => 'privacy:metadata:events_queue:userid',
91+
'timecreated' => 'privacy:metadata:events_queue:timecreated',
92+
], 'privacy:metadata:events_queue');
93+
94+
return $collection;
95+
}
96+
97+
/**
98+
* Get the list of contexts that contain user information for the specified user.
99+
*
100+
* @param int $userid The user to search.
101+
* @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin.
102+
*/
103+
public static function get_contexts_for_userid($userid) {
104+
return new contextlist();
105+
}
106+
107+
/**
108+
* Export all user data for the specified user, in the specified contexts.
109+
*
110+
* @param approved_contextlist $contextlist The approved contexts to export information for.
111+
*/
112+
public static function export_user_data(approved_contextlist $contextlist) {
113+
// None of the core tables should be exported.
114+
}
115+
116+
/**
117+
* Delete all data for all users in the specified context.
118+
*
119+
* @param context $context The specific context to delete data for.
120+
*/
121+
public static function delete_data_for_all_users_in_context(\context $context) {
122+
// None of the the data from these tables should be deleted.
123+
}
124+
125+
/**
126+
* Delete all user data for the specified user, in the specified contexts.
127+
*
128+
* @param approved_contextlist $contextlist The approved contexts and user information to delete information for.
129+
*/
130+
public static function delete_data_for_user(approved_contextlist $contextlist) {
131+
// None of the the data from these tables should be deleted.
132+
// Note: Although it may be tempting to delete the adhoc task data, do not do so.
133+
// The delete process is run as an adhoc task.
134+
}
135+
}

privacy/classes/manager.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,12 @@ protected function component_is_core_provider($component) {
393393
* @return array the array of frankenstyle component names.
394394
*/
395395
protected function get_component_list() {
396-
return array_keys(array_reduce(\core_component::get_component_list(), function($carry, $item) {
396+
$components = array_keys(array_reduce(\core_component::get_component_list(), function($carry, $item) {
397397
return array_merge($carry, $item);
398398
}, []));
399+
$components[] = 'core';
400+
401+
return $components;
399402
}
400403

401404
/**

0 commit comments

Comments
 (0)