mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 00:16:46 +02:00
MDL-61743 core_privacy: Reduce context specificty
Deletion is called for a context against all components, not just modules.
This commit is contained in:
parent
2bd2660751
commit
fa9243cd85
1 changed files with 17 additions and 17 deletions
|
@ -90,10 +90,8 @@ class helper {
|
||||||
* @param context $context The specific context to delete data for.
|
* @param context $context The specific context to delete data for.
|
||||||
*/
|
*/
|
||||||
public static function delete_data_for_all_users_in_context(string $component, \context $context) {
|
public static function delete_data_for_all_users_in_context(string $component, \context $context) {
|
||||||
if (strpos($component, 'mod_') === 0) {
|
// Activity modules support data stored by core about them - for example, activity completion.
|
||||||
// Activity modules support data stored by core about them - for example, activity completion.
|
static::delete_data_for_all_users_in_context_course_module($component, $context);
|
||||||
static::delete_data_for_all_users_in_context_course_module($component, $context);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -106,10 +104,8 @@ class helper {
|
||||||
public static function delete_data_for_user(approved_contextlist $contextlist) {
|
public static function delete_data_for_user(approved_contextlist $contextlist) {
|
||||||
$component = $contextlist->get_component();
|
$component = $contextlist->get_component();
|
||||||
|
|
||||||
if (strpos($component, 'mod_') === 0) {
|
// Activity modules support data stored by core about them - for example, activity completion.
|
||||||
// Activity modules support data stored by core about them - for example, activity completion.
|
static::delete_data_for_user_in_course_module($contextlist);
|
||||||
static::delete_data_for_user_in_course_module($contextlist);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -270,13 +266,15 @@ class helper {
|
||||||
* This will handle deletion for things such as activity completion.
|
* This will handle deletion for things such as activity completion.
|
||||||
*
|
*
|
||||||
* @param string $component The component being deleted for.
|
* @param string $component The component being deleted for.
|
||||||
* @param \context_module $context The context to delete all data for.
|
* @param \context $context The context to delete all data for.
|
||||||
*/
|
*/
|
||||||
public static function delete_data_for_all_users_in_context_course_module(string $component, \context_module $context) {
|
public static function delete_data_for_all_users_in_context_course_module(string $component, \context $context) {
|
||||||
global $DB;
|
global $DB;
|
||||||
|
|
||||||
// Delete course completion data for this context.
|
if ($context instanceof \context_module) {
|
||||||
$DB->delete_records('course_modules_completion', ['coursemoduleid' => $context->instanceid]);
|
// Delete course completion data for this context.
|
||||||
|
$DB->delete_records('course_modules_completion', ['coursemoduleid' => $context->instanceid]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -290,11 +288,13 @@ class helper {
|
||||||
global $DB;
|
global $DB;
|
||||||
|
|
||||||
foreach ($contextlist as $context) {
|
foreach ($contextlist as $context) {
|
||||||
// Delete course completion data for this context.
|
if ($context instanceof \context_module) {
|
||||||
$DB->delete_records('course_modules_completion', [
|
// Delete course completion data for this context.
|
||||||
'coursemoduleid' => $context->instanceid,
|
$DB->delete_records('course_modules_completion', [
|
||||||
'userid' => $contextlist->get_user()->id,
|
'coursemoduleid' => $context->instanceid,
|
||||||
]);
|
'userid' => $contextlist->get_user()->id,
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue