Skip to content

Commit 0c1c29d

Browse files
committed
Work: Fix access to download files
1 parent 408651c commit 0c1c29d

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

main/work/work.lib.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5970,7 +5970,13 @@ function getWorkUserListData(
59705970
*/
59715971
function downloadFile($id, $course_info, $isCorrection)
59725972
{
5973-
return getFile($id, $course_info, true, $isCorrection, true);
5973+
return getFile(
5974+
$id,
5975+
$course_info,
5976+
true,
5977+
$isCorrection,
5978+
api_is_course_admin() || api_is_coach()
5979+
);
59745980
}
59755981

59765982
/**
@@ -6055,7 +6061,7 @@ function getFileContents($id, $courseInfo, $sessionId = 0, $correction = false,
60556061
$forceAccessForCourseAdmins
60566062
);
60576063

6058-
if (empty($isAllow)) {
6064+
if (!$isAllow) {
60596065
return false;
60606066
}
60616067

@@ -6093,9 +6099,9 @@ function getFileContents($id, $courseInfo, $sessionId = 0, $correction = false,
60936099
$is_editor = api_is_allowed_to_edit(true, true, true);
60946100
$student_is_owner_of_work = user_is_author($row['id'], api_get_user_id());
60956101

6096-
if (($forceAccessForCourseAdmins && $isAllow) ||
6097-
$is_editor ||
6102+
if ($is_editor ||
60986103
$student_is_owner_of_work ||
6104+
($forceAccessForCourseAdmins && $isAllow) ||
60996105
($doc_visible_for_all && $work_is_visible)
61006106
) {
61016107
$title = $row['title'];

0 commit comments

Comments
 (0)