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 * Test provider which works.
20 * @package core_privacy
21 * @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25 namespace mod_component_a\privacy
;
27 defined('MOODLE_INTERNAL') ||
die();
29 use core_privacy\local\metadata\collection
;
30 use core_privacy\local\request\contextlist
;
31 use core_privacy\local\request\approved_contextlist
;
34 * Mock core_user_data_provider for unit tests.
36 * @package core_privacy
37 * @copyright 2018 Andrew Nicols <andrew@nicols.co.uk>
38 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
40 class provider
implements
41 \core_privacy\local\metadata\provider
,
42 \core_privacy\local\request\plugin\provider
{
47 * @param collection $collection The initialised collection to add items to.
48 * @return collection A listing of user data stored through this system.
50 public static function get_metadata(collection
$collection) : collection
{
51 $collection->add_subsystem_link('core_files');
56 * Get the list of contexts that contain user information for the specified user.
58 * @param int $userid The user to search.
59 * @return contextlist $contextlist The contextlist containing the list of contexts used in this plugin.
61 public static function get_contexts_for_userid(int $userid) : \core_privacy\local\request\contextlist
{
62 $c = new \core_privacy\local\request\
contextlist();
63 $c->add_system_context();
69 * Export all user data for the specified user, in the specified contexts.
71 * @param approved_contextlist $contextlist The approved contexts to export information for.
73 public static function export_user_data(approved_contextlist
$contextlist) {
77 * Delete all data for all users in the specified context.
79 * @param context $context The specific context to delete data for.
81 public static function delete_data_for_all_users_in_context(\context
$context) {
85 * Delete all user data for the specified user, in the specified contexts.
87 * @param approved_contextlist $contextlist The approved contexts and user information to delete information for.
89 public static function delete_data_for_user(approved_contextlist
$contextlist) {