2 // This file is part of Moodle - http://moodle.org/
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.
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/>.
18 * Privacy class for requesting user data.
20 * @package tool_dataprivacy
21 * @copyright 2018 Jake Dallimore <jrhdallimore@gmail.com>
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25 namespace tool_dataprivacy\privacy
;
26 defined('MOODLE_INTERNAL') ||
die();
28 use core_privacy\local\metadata\collection
;
29 use core_privacy\local\request\approved_contextlist
;
30 use core_privacy\local\request\context
;
31 use core_privacy\local\request\contextlist
;
34 * Privacy class for requesting user data.
36 * @package tool_dataprivacy
37 * @copyright 2018 Jake Dallimore <jrhdallimore@gmail.com>
38 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
40 class provider
implements
41 // This tool stores user data.
42 \core_privacy\local\metadata\provider
,
44 // This tool may provide access to and deletion of user data.
45 \core_privacy\local\request\plugin\provider
{
47 * Returns meta data about this system.
49 * @param collection $collection The initialised collection to add items to.
50 * @return collection A listing of user data stored through this system.
52 public static function get_metadata(collection
$collection) : collection
{
53 $collection->add_database_table(
54 'tool_dataprivacy_request',
56 'comments' => 'privacy:metadata:request:comments',
57 'userid' => 'privacy:metadata:request:userid',
58 'requestedby' => 'privacy:metadata:request:requestedby',
59 'dpocomment' => 'privacy:metadata:request:dpocomment',
60 'timecreated' => 'privacy:metadata:request:timecreated'
62 'privacy:metadata:request'
68 * Get the list of contexts that contain user information for the specified user.
70 * @param int $userid The user to search.
71 * @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin.
73 public static function get_contexts_for_userid(int $userid) : contextlist
{
74 return new contextlist();
78 * Export all user data for the specified user, in the specified contexts.
80 * @param approved_contextlist $contextlist The approved contexts to export information for.
82 public static function export_user_data(approved_contextlist
$contextlist) {
86 * Delete all data for all users in the specified context.
88 * @param context $context The specific context to delete data for.
90 public static function delete_data_for_all_users_in_context(\context
$context) {
94 * Delete all user data for the specified user, in the specified contexts.
96 * @param approved_contextlist $contextlist The approved contexts and user information to delete information for.
98 public static function delete_data_for_user(approved_contextlist
$contextlist) {