Gitlab CSE Unil

Commit 5a42f8df authored by M. Chardon's avatar M. Chardon
Browse files

maj editpdf 2018-08

parent fc6121b0
...@@ -41,23 +41,23 @@ defined('MOODLE_INTERNAL') || die(); ...@@ -41,23 +41,23 @@ defined('MOODLE_INTERNAL') || die();
function assignfeedback_editpdfplus_pluginfile($course, $cm, context $context, $filearea, $args, $forcedownload, array $options = array()) { function assignfeedback_editpdfplus_pluginfile($course, $cm, context $context, $filearea, $args, $forcedownload, array $options = array()) {
global $USER, $DB, $CFG; global $USER, $DB, $CFG;
require_once($CFG->dirroot . '/mod/assign/locallib.php');
if ($context->contextlevel == CONTEXT_MODULE) { if ($context->contextlevel == CONTEXT_MODULE) {
require_login($course, false, $cm); require_login($course, false, $cm);
$itemid = (int) array_shift($args); $itemid = (int) array_shift($args);
if (!$assign = $DB->get_record('assign', array('id' => $cm->instance))) { $assign = new assign($context, $cm, $course);
return false;
}
$record = $DB->get_record('assign_grades', array('id' => $itemid), 'userid,assignment', MUST_EXIST); $record = $DB->get_record('assign_grades', array('id' => $itemid), 'userid,assignment', MUST_EXIST);
$userid = $record->userid; $userid = $record->userid;
if ($assign->id != $record->assignment) { if ($assign->get_instance()->id != $record->assignment) {
return false; return false;
} }
// Check is users feedback or has grading permission. // Rely on mod_assign checking permissions.
if ($USER->id != $userid and ! has_capability('mod/assign:grade', $context)) { if (!$assign->can_view_submission($userid)) {
return false; return false;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment