From 41a0a8f97f711aaf66c90f71187c9b39255882c2 Mon Sep 17 00:00:00 2001 From: Mihail Geshoski Date: Thu, 8 Nov 2018 14:08:43 +0800 Subject: [PATCH 1/2] MDL-63919 privacy: Disable notifications for auto created data requests --- .../task/initiate_data_request_task.php | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/admin/tool/dataprivacy/classes/task/initiate_data_request_task.php b/admin/tool/dataprivacy/classes/task/initiate_data_request_task.php index d35f9176ef9..1e02a2f8988 100644 --- a/admin/tool/dataprivacy/classes/task/initiate_data_request_task.php +++ b/admin/tool/dataprivacy/classes/task/initiate_data_request_task.php @@ -88,13 +88,19 @@ class initiate_data_request_task extends adhoc_task { // Get the list of the site Data Protection Officers. $dpos = api::get_site_dpos(); - // Email the data request to the Data Protection Officer(s)/Admin(s). - foreach ($dpos as $dpo) { - $dponame = fullname($dpo); - if (api::notify_dpo($dpo, $datarequest)) { - mtrace('Message sent to DPO: ' . $dponame); - } else { - mtrace('A problem was encountered while sending the message to the DPO: ' . $dponame); + // We should prevent DPO(s)/Admin(s) being flooded with notifications for each request when bulk delete + // data requests are being created. + // NOTE: This should be improved, we should not totally disable the notifications for automatically + // created requests. Possibly, we should create one notification for these such cases. + if ($datarequest->get('creationmethod') != data_request::DATAREQUEST_CREATION_AUTO) { + // Email the data request to the Data Protection Officer(s)/Admin(s). + foreach ($dpos as $dpo) { + $dponame = fullname($dpo); + if (api::notify_dpo($dpo, $datarequest)) { + mtrace('Message sent to DPO: ' . $dponame); + } else { + mtrace('A problem was encountered while sending the message to the DPO: ' . $dponame); + } } } } From 6ac295cd269529559f28e5cd0950d0690b5afcc6 Mon Sep 17 00:00:00 2001 From: Mihail Geshoski Date: Thu, 8 Nov 2018 14:13:31 +0800 Subject: [PATCH 2/2] MDL-63919 privacy: Store the creation method of the data request --- admin/tool/dataprivacy/classes/api.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/admin/tool/dataprivacy/classes/api.php b/admin/tool/dataprivacy/classes/api.php index 10889a915ec..5c08f5fe617 100644 --- a/admin/tool/dataprivacy/classes/api.php +++ b/admin/tool/dataprivacy/classes/api.php @@ -253,6 +253,8 @@ class api { $datarequest->set('type', $type); // Set request comments. $datarequest->set('comments', $comments); + // Set the creation method. + $datarequest->set('creationmethod', $creationmethod); // Store subject access request. $datarequest->create();