Skip to content

Commit

Permalink
MDL-13776 assignment attachment access now verified in module context…
Browse files Browse the repository at this point in the history
…; merged from MOODLE_19_STABLE
  • Loading branch information
skodak committed Jul 5, 2008
1 parent ff96219 commit 9da3dfa
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions file.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,17 @@
and (strtolower($args[2]) == 'assignment')) {

$lifetime = 0; // do not cache assignments, students may reupload them
if (!has_capability('mod/assignment:grade', get_context_instance(CONTEXT_COURSE, $course->id))
and $args[4] != $USER->id) {
print_error('nopermissions');
}
if ($args[4] == $USER->id) {
//can view own assignemnt submissions
} else {
$instance = (int)$args[3];
if (!$cm = get_coursemodule_from_instance('assignment', $instance, $course->id)) {
not_found($course->id);
}
if (!has_capability('mod/assignment:grade', get_context_instance(CONTEXT_MODULE, $cm->id))) {
print_error('nopermissions');
}
}
}

// security: force download of all attachments submitted by students
Expand Down

0 comments on commit 9da3dfa

Please sign in to comment.