MDL-64714 core_auth: Fix early break foreach in delete_data_for_user

This commit is contained in:
cescobedo 2019-02-05 12:51:34 +01:00
parent a62e275984
commit 00b4f9e234
2 changed files with 12 additions and 7 deletions

View file

@ -273,13 +273,15 @@ class provider implements
return;
}
$userid = $contextlist->get_user()->id;
foreach ($contextlist->get_contexts() as $context) {
if ($context->contextlevel != CONTEXT_USER) {
return;
continue;
}
if ($context->instanceid == $userid) {
// Because we only use user contexts the instance ID is the user ID.
$DB->delete_records('mnet_log', ['userid' => $context->instanceid]);
}
}
}
}

View file

@ -178,14 +178,17 @@ class provider implements
if (empty($contextlist->count())) {
return;
}
$userid = $contextlist->get_user()->id;
foreach ($contextlist->get_contexts() as $context) {
if ($context->contextlevel != CONTEXT_USER) {
return;
continue;
}
if ($context->instanceid == $userid) {
// Because we only use user contexts the instance ID is the user ID.
static::delete_user_data($context->instanceid);
}
}
}
/**
* This does the deletion of user data for the auth_oauth2.