mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-49826 grade: hide singleview links when no permissions
Singleview only supports grade editors not viewers at this time.
This commit is contained in:
parent
1b5034025b
commit
4ae71e93a8
@ -2887,6 +2887,12 @@ abstract class grade_helper {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Singleview doesn't doesn't accomodate for all cap combos yet, so this is hardcoded..
|
||||
if ($plugin === 'singleview' && !has_all_capabilities(array('moodle/grade:viewall',
|
||||
'moodle/grade:edit'), $context)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$pluginstr = get_string('pluginname', 'gradereport_'.$plugin);
|
||||
$url = new moodle_url('/grade/report/'.$plugin.'/index.php', array('id'=>$courseid));
|
||||
$gradereports[$plugin] = new grade_plugin_info($plugin, $url, $pluginstr);
|
||||
|
@ -590,7 +590,8 @@ class grade_report_grader extends grade_report {
|
||||
|
||||
$showuserimage = $this->get_pref('showuserimage');
|
||||
$canseeuserreport = has_capability('gradereport/'.$CFG->grade_profilereport.':view', $this->context);
|
||||
$canseesingleview = has_capability('gradereport/singleview:view', $this->context);
|
||||
$canseesingleview = has_all_capabilities(array('gradereport/singleview:view', 'moodle/grade:viewall',
|
||||
'moodle/grade:edit'), $this->context);
|
||||
$hasuserreportcell = $canseeuserreport || $canseesingleview;
|
||||
|
||||
$strfeedback = $this->get_lang_string("feedback");
|
||||
@ -836,7 +837,9 @@ class grade_report_grader extends grade_report {
|
||||
}
|
||||
|
||||
$singleview = '';
|
||||
if (has_capability('gradereport/singleview:view', $this->context)) {
|
||||
if (has_all_capabilities(array('gradereport/singleview:view', 'moodle/grade:viewall',
|
||||
'moodle/grade:edit'), $this->context)) {
|
||||
|
||||
$url = new moodle_url('/grade/report/singleview/index.php', array(
|
||||
'id' => $this->course->id,
|
||||
'item' => 'grade',
|
||||
|
Loading…
x
Reference in New Issue
Block a user