Skip to content

Commit

Permalink
issue#110 fixed delete operations in privacy provider
Browse files Browse the repository at this point in the history
  • Loading branch information
jackboylan committed Jan 18, 2024
1 parent 25192bc commit e1a90c4
Showing 1 changed file with 3 additions and 23 deletions.
26 changes: 3 additions & 23 deletions classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

namespace tool_securityquestions\privacy;
use core_privacy\local\metadata\collection;
use core_privacy\local\request\contextlist;
use core_privacy\local\request\approved_contextlist;
Expand Down Expand Up @@ -219,32 +218,13 @@ public static function delete_data_for_all_users_in_context(\context $context) {
public static function delete_data_for_user(approved_contextlist $contextlist) {
global $DB;
$userid = $contextlist->get_user()->id;

foreach ($contextlist as $context) {

// If not in user context, exit loop.
if ($context->contextlevel == CONTEXT_SYSTEM) {

$sql = "
DELETE
FROM {tool_securityquestions_ans} l
WHERE l.userid = :userid";

$DB->execute($sql, ['userid' => $userid]);

$sql = "
DELETE
FROM {tool_securityquestions_loc} l
WHERE l.userid = :userid";

$DB->execute($sql, ['userid' => $userid]);

$sql = "
DELETE
FROM {tool_securityquestions_res} l
WHERE l.userid = :userid";

$DB->execute($sql, ['userid' => $userid]);
$DB->delete_records('tool_securityquestions_res',['userid' => $userid]);
$DB->delete_records('tool_securityquestions_ans',['userid' => $userid]);
$DB->delete_records('tool_securityquestions_loc',['userid' => $userid]);
}
}
}
Expand Down

0 comments on commit e1a90c4

Please sign in to comment.