From 2d4a3e6894604bb944e876d4d212bf7a97cd2743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mudr=C3=A1k?= Date: Thu, 28 Feb 2013 16:36:01 +0100 Subject: [PATCH] MDL-37522 Serve images from published submissions If the user is allowed to see the published submission, she must be also able to see images in it (both embedded into the text as well as attached to the submission). See the logic in submission.php as a reference. --- mod/workshop/lib.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mod/workshop/lib.php b/mod/workshop/lib.php index f927ac23fcc..6959e54fc95 100644 --- a/mod/workshop/lib.php +++ b/mod/workshop/lib.php @@ -1275,7 +1275,11 @@ function workshop_pluginfile($course, $cm, $context, $filearea, array $args, $fo // make sure the user is allowed to see the file if (empty($submission->example)) { if ($USER->id != $submission->authorid) { - if (!$DB->record_exists('workshop_assessments', array('submissionid' => $submission->id, 'reviewerid' => $USER->id))) { + if ($submission->published == 1 and $workshop->phase == 50 + and has_capability('mod/workshop:viewpublishedsubmissions', $context)) { + // Published submission, we can go (workshop does not take the group mode + // into account in this case yet). + } else if (!$DB->record_exists('workshop_assessments', array('submissionid' => $submission->id, 'reviewerid' => $USER->id))) { if (!has_capability('mod/workshop:viewallsubmissions', $context)) { send_file_not_found(); } else {