MDL-72772 gradereport_overview: account for users with parent roles.

This commit is contained in:
Paul Holden 2022-01-12 11:07:34 +00:00 committed by Eloy Lafuente (stronk7)
parent 7cba3c5d13
commit 6d18f136ae
2 changed files with 13 additions and 3 deletions

View file

@ -193,7 +193,9 @@ switch ($mode) {
require_once $CFG->dirroot.'/grade/report/'.$CFG->grade_profilereport.'/lib.php';
// User must be able to view this grade report.
require_capability('gradereport/' . $CFG->grade_profilereport .':view', $coursecontext);
if (!$viewasuser) {
require_capability('gradereport/' . $CFG->grade_profilereport . ':view', $coursecontext);
}
$functionname = 'grade_report_'.$CFG->grade_profilereport.'_profilereport';
if (function_exists($functionname)) {