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 Subsystem implementation for repository_merlot.
20 * @package repository_merlot
21 * @copyright 2018 Zig Tan <zig@moodle.com>
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25 namespace repository_merlot\privacy
;
27 use core_privacy\local\metadata\collection
;
28 use core_privacy\local\request\approved_contextlist
;
29 use core_privacy\local\request\approved_userlist
;
30 use core_privacy\local\request\context
;
31 use core_privacy\local\request\contextlist
;
32 use core_privacy\local\request\userlist
;
34 defined('MOODLE_INTERNAL') ||
die();
37 * Privacy Subsystem for repository_merlot implementing metadata and plugin providers.
39 * @copyright 2018 Zig Tan <zig@moodle.com>
40 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
42 class provider
implements
43 \core_privacy\local\metadata\provider
,
44 \core_privacy\local\request\core_userlist_provider
,
45 \core_privacy\local\request\plugin\provider
{
48 * Returns meta data about this system.
50 * @param collection $collection The initialised collection to add items to.
51 * @return collection A listing of user data stored through this system.
53 public static function get_metadata(collection
$collection) : collection
{
54 $collection->add_external_location_link(
57 'author' => 'privacy:metadata:repository_merlot:author',
58 'keywords' => 'privacy:metadata:repository_merlot:keywords',
59 'licencekey' => 'privacy:metadata:repository_merlot:licencekey'
61 'privacy:metadata:repository_merlot'
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 * Get the list of users who have data within a context.
80 * @param userlist $userlist The userlist containing the list of users who have data in this context/plugin combination.
82 public static function get_users_in_context(userlist
$userlist) {
86 * Export all user data for the specified user, in the specified contexts.
88 * @param approved_contextlist $contextlist The approved contexts to export information for.
90 public static function export_user_data(approved_contextlist
$contextlist) {
94 * Delete all data for all users in the specified context.
96 * @param context $context The specific context to delete data for.
98 public static function delete_data_for_all_users_in_context(\context
$context) {
102 * Delete all user data for the specified user, in the specified contexts.
104 * @param approved_contextlist $contextlist The approved contexts and user information to delete information for.
106 public static function delete_data_for_user(approved_contextlist
$contextlist) {
110 * Delete multiple users within a single context.
112 * @param approved_userlist $userlist The approved context and user information to delete information for.
114 public static function delete_data_for_users(approved_userlist
$userlist) {