MDL-63867 tool_dataprivacy: Fix context expired/unprotected user check
It now checks the system context has been defined, since that is required for data privacy to be set up correctly, and the check to be valid. This also fixes an error being thrown when checking pending delete requests in cron.
This commit is contained in:
@@ -887,6 +887,11 @@ class expired_contexts_manager {
|
||||
* @return bool
|
||||
*/
|
||||
public static function is_context_expired_or_unprotected_for_user(\context $context, \stdClass $user) : bool {
|
||||
// User/course contexts can't expire if no purpose is set in the system context.
|
||||
if (!data_registry::defaults_set()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$parents = $context->get_parent_contexts(true);
|
||||
foreach ($parents as $parent) {
|
||||
if ($parent instanceof \context_course) {
|
||||
|
||||
Reference in New Issue
Block a user