mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 01:16:44 +02:00
MDL-29080 grade: simplified bug fix to prevent users without the required capabilities from being able to export hidden grade items
This commit is contained in:
parent
baa5cd8240
commit
8887fd9a77
1 changed files with 8 additions and 1 deletions
|
@ -115,7 +115,14 @@ class grade_export_form extends moodleform {
|
|||
|
||||
if ($grade_items = $gseq->items) {
|
||||
$needs_multiselect = false;
|
||||
$canviewhidden = has_capability('moodle/grade:viewhidden', get_context_instance(CONTEXT_COURSE, $COURSE->id));
|
||||
|
||||
foreach ($grade_items as $grade_item) {
|
||||
// Is the grade_item hidden? If so, can the user see hidden grade_items?
|
||||
if ($grade_item->is_hidden() && !$canviewhidden) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!empty($features['idnumberrequired']) and empty($grade_item->idnumber)) {
|
||||
$mform->addElement('advcheckbox', 'itemids['.$grade_item->id.']', $grade_item->get_name(), get_string('noidnumber', 'grades'));
|
||||
$mform->hardFreeze('itemids['.$grade_item->id.']');
|
||||
|
@ -124,7 +131,7 @@ class grade_export_form extends moodleform {
|
|||
$mform->setDefault('itemids['.$grade_item->id.']', 1);
|
||||
$needs_multiselect = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($needs_multiselect) {
|
||||
$this->add_checkbox_controller(1, null, null, 1); // 1st argument is group name, 2nd is link text, 3rd is attributes and 4th is original value
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue