Bugfix and simplification in privacy provider
This commit is contained in:
parent
ad02879928
commit
4ca2c875ef
|
@ -195,15 +195,8 @@ class provider implements \core_privacy\local\metadata\provider,
|
|||
foreach ($contextlist->get_contexts() as $context) {
|
||||
|
||||
if ($context->contextlevel == CONTEXT_SYSTEM) {
|
||||
$sql = "SELECT s.id FROM {local_treestudyplan}
|
||||
INNER JOIN {local_treestudyplan_user} a ON a.studyplan_id = s.id
|
||||
WHERE ( a.user_id = :userid
|
||||
AND ( s.context_id IS NULL OR s.context_id == 0 OR s.context_id = :contextid))";
|
||||
$planids = $DB->get_fieldset_sql($sql, ["contextid" => $context->id, "userid" => $user->id]);
|
||||
|
||||
foreach ($planids as $planid) {
|
||||
$DB->delete_records("local_treestudyplan_user", ["studyplan_id" => $planid, "user_id" => $user->id]);
|
||||
}
|
||||
// Delete all associations for this user if the system context is included.
|
||||
$DB->delete_records("local_treestudyplan_user", ["user_id" => $user->id]);
|
||||
|
||||
// Also delete all invitations for this user.
|
||||
$DB->delete_records("local_treestudyplan_invit", ["user_id" => $user->id]);
|
||||
|
|
Loading…
Reference in New Issue
Block a user