From 5a3280a18ffd634cd2bc0426a0b517617c1733ed Mon Sep 17 00:00:00 2001 From: David Monllao Date: Fri, 20 Apr 2018 10:27:05 +0200 Subject: [PATCH] MDL-61899 tool_dataprivacy: Replace wrong function for subject scope --- admin/tool/dataprivacy/classes/data_registry.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/admin/tool/dataprivacy/classes/data_registry.php b/admin/tool/dataprivacy/classes/data_registry.php index cdf9de11e46..39e3e531b7b 100644 --- a/admin/tool/dataprivacy/classes/data_registry.php +++ b/admin/tool/dataprivacy/classes/data_registry.php @@ -146,10 +146,12 @@ class data_registry { public static function get_subject_scope(\context $context) { if ($contextcourse = $context->get_course_context(false)) { - // Below course level we only look at course-assigned roles. - $roles = get_user_roles($contextcourse, 0, false); + // Below course level we look at module or block level roles + course-assigned roles. + $courseroles = get_roles_with_assignment_on_context($contextcourse); + $roles = $courseroles + get_roles_with_assignment_on_context($context); } else { - $roles = get_user_roles($context, 0, false); + // We list category + system for others (we don't work with user instances so no need to work about them). + $roles = get_roles_used_in_context($context); } return array_map(function($role) {