mirror of
https://github.com/moodle/moodle.git
synced 2025-04-03 15:32:43 +02:00
Merge branch 'MDL-61899_master-fixsubjectscope' of git://github.com/dmonllao/moodle
This commit is contained in:
commit
837b937511
@ -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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user