mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
Merge branch 'MDL-62782-master' of git://github.com/damyon/moodle
This commit is contained in:
commit
75ad50cba0
@ -45,23 +45,23 @@ function assignfeedback_editpdf_pluginfile($course,
|
||||
array $options=array()) {
|
||||
global $USER, $DB, $CFG;
|
||||
|
||||
require_once($CFG->dirroot . '/mod/assign/locallib.php');
|
||||
|
||||
if ($context->contextlevel == CONTEXT_MODULE) {
|
||||
|
||||
require_login($course, false, $cm);
|
||||
$itemid = (int)array_shift($args);
|
||||
|
||||
if (!$assign = $DB->get_record('assign', array('id'=>$cm->instance))) {
|
||||
return false;
|
||||
}
|
||||
$assign = new assign($context, $cm, $course);
|
||||
|
||||
$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;
|
||||
if ($assign->id != $record->assignment) {
|
||||
if ($assign->get_instance()->id != $record->assignment) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check is users feedback or has grading permission.
|
||||
if ($USER->id != $userid and !has_capability('mod/assign:grade', $context)) {
|
||||
// Rely on mod_assign checking permissions.
|
||||
if (!$assign->can_view_submission($userid)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -42,27 +42,27 @@ function assignfeedback_file_pluginfile($course,
|
||||
$args,
|
||||
$forcedownload,
|
||||
array $options=array()) {
|
||||
global $USER, $DB;
|
||||
global $USER, $DB, $CFG, $PAGE;
|
||||
|
||||
if ($context->contextlevel != CONTEXT_MODULE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
require_once($CFG->dirroot . '/mod/assign/locallib.php');
|
||||
|
||||
require_login($course, false, $cm);
|
||||
$itemid = (int)array_shift($args);
|
||||
$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;
|
||||
|
||||
if (!$assign = $DB->get_record('assign', array('id'=>$cm->instance))) {
|
||||
$assign = new assign($context, $cm, $course);
|
||||
|
||||
if ($assign->get_instance()->id != $record->assignment) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($assign->id != $record->assignment) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check is users feedback or has grading permission.
|
||||
if ($USER->id != $userid and !has_capability('mod/assign:grade', $context)) {
|
||||
// Rely on mod_assign checking permissions.
|
||||
if (!$assign->can_view_submission($userid)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user