Skip to content

Commit

Permalink
Merge branch 'MDL-61899_master-fixsubjectscope' of git://github.com/d…
Browse files Browse the repository at this point in the history
…monllao/moodle
  • Loading branch information
stronk7 committed Apr 20, 2018
2 parents c3002d2 + 5a3280a commit 837b937
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions admin/tool/dataprivacy/classes/data_registry.php
Expand Up @@ -146,10 +146,12 @@ public static function get_site_categories() {
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) {
Expand Down

0 comments on commit 837b937

Please sign in to comment.