From 63e4e0d69d110b381f8d76373a67b59c87667196 Mon Sep 17 00:00:00 2001 From: Shamim Rezaie Date: Fri, 19 Oct 2018 14:28:17 +1100 Subject: [PATCH] MDL-63713 core: Support for removal of context users This issue is part of the MDL-62560 Epic. --- lib/classes/privacy/provider.php | 34 ++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/lib/classes/privacy/provider.php b/lib/classes/privacy/provider.php index 0e41d71adc8..b9d1d670a81 100644 --- a/lib/classes/privacy/provider.php +++ b/lib/classes/privacy/provider.php @@ -18,6 +18,7 @@ * Privacy class for requesting user data. * * @package core + * @category privacy * @copyright 2018 Andrew Nicols * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -26,9 +27,11 @@ namespace core\privacy; defined('MOODLE_INTERNAL') || die(); -use \core_privacy\local\metadata\collection; -use \core_privacy\local\request\contextlist; -use \core_privacy\local\request\approved_contextlist; +use core_privacy\local\metadata\collection; +use core_privacy\local\request\approved_contextlist; +use core_privacy\local\request\approved_userlist; +use core_privacy\local\request\contextlist; +use core_privacy\local\request\userlist; /** * Privacy class for requesting user data. @@ -37,7 +40,10 @@ use \core_privacy\local\request\approved_contextlist; * @copyright 2018 Andrew Nicols * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -class provider implements \core_privacy\local\metadata\provider, \core_privacy\local\request\subsystem\provider { +class provider implements + \core_privacy\local\metadata\provider, + \core_privacy\local\request\subsystem\provider, + \core_privacy\local\request\core_userlist_provider { /** * Returns information about the user data stored in this component. @@ -114,6 +120,15 @@ class provider implements \core_privacy\local\metadata\provider, \core_privacy\l return new contextlist(); } + /** + * Get the list of users who have data within a context. + * + * @param userlist $userlist The userlist containing the list of users who have data in this context/plugin combination. + */ + public static function get_users_in_context(userlist $userlist) { + // Don't add any user. + } + /** * Export all user data for the specified user, in the specified contexts. * @@ -142,4 +157,15 @@ class provider implements \core_privacy\local\metadata\provider, \core_privacy\l // Note: Although it may be tempting to delete the adhoc task data, do not do so. // The delete process is run as an adhoc task. } + + /** + * Delete multiple users within a single context. + * + * @param approved_userlist $userlist The approved context and user information to delete information for. + */ + public static function delete_data_for_users(approved_userlist $userlist) { + // None of the the data from these tables should be deleted. + // Note: Although it may be tempting to delete the adhoc task data, do not do so. + // The delete process is run as an adhoc task. + } }