mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-64714 core_auth: Fix early break foreach in delete_data_for_user
This commit is contained in:
parent
a62e275984
commit
00b4f9e234
2 changed files with 12 additions and 7 deletions
|
@ -273,13 +273,15 @@ class provider implements
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$userid = $contextlist->get_user()->id;
|
||||||
foreach ($contextlist->get_contexts() as $context) {
|
foreach ($contextlist->get_contexts() as $context) {
|
||||||
if ($context->contextlevel != CONTEXT_USER) {
|
if ($context->contextlevel != CONTEXT_USER) {
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
|
if ($context->instanceid == $userid) {
|
||||||
// Because we only use user contexts the instance ID is the user ID.
|
// Because we only use user contexts the instance ID is the user ID.
|
||||||
$DB->delete_records('mnet_log', ['userid' => $context->instanceid]);
|
$DB->delete_records('mnet_log', ['userid' => $context->instanceid]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -178,14 +178,17 @@ class provider implements
|
||||||
if (empty($contextlist->count())) {
|
if (empty($contextlist->count())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
$userid = $contextlist->get_user()->id;
|
||||||
foreach ($contextlist->get_contexts() as $context) {
|
foreach ($contextlist->get_contexts() as $context) {
|
||||||
if ($context->contextlevel != CONTEXT_USER) {
|
if ($context->contextlevel != CONTEXT_USER) {
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
|
if ($context->instanceid == $userid) {
|
||||||
// Because we only use user contexts the instance ID is the user ID.
|
// Because we only use user contexts the instance ID is the user ID.
|
||||||
static::delete_user_data($context->instanceid);
|
static::delete_user_data($context->instanceid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This does the deletion of user data for the auth_oauth2.
|
* This does the deletion of user data for the auth_oauth2.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue