Skip to content

Commit

Permalink
Fix work access for teachers and students
Browse files Browse the repository at this point in the history
  • Loading branch information
jmontoyaa committed Apr 9, 2018
1 parent 0356a28 commit 00f3e4a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions main/work/work.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -5197,10 +5197,10 @@ function getFileContents($id, $course_info, $sessionId = 0, $correction = false)
*/

$work_is_visible = $item_info['visibility'] == 1 && $row['accepted'] == 1;
$doc_visible_for_all = $course_info['show_score'] == 1;
$doc_visible_for_all = (int) $course_info['show_score'] === 0;

$is_editor = api_is_allowed_to_edit(true, true, true);
$student_is_owner_of_work = user_is_author($row['id'], $row['user_id']);
$student_is_owner_of_work = user_is_author($row['id'], api_get_user_id());

This comment has been minimized.

Copy link
@ywarnier

ywarnier Apr 9, 2018

Member

Here you are just forcing the user_id to be the one of the current user, but make sure that is not breaking it for the teacher/coach now (they also need access to the file).

This comment has been minimized.

Copy link
@jmontoyaa

jmontoyaa Apr 10, 2018

Author Member

The teacher/session coach will have access because of $is_editor = api_is_allowed_to_edit(true, true, true)

This comment has been minimized.

Copy link
@AngelFQC

AngelFQC Apr 10, 2018

Member

$student_is_owner_of_work should be $currentUserIsOwnerOfWork

This comment has been minimized.

Copy link
@jmontoyaa

jmontoyaa Apr 10, 2018

Author Member

This was a bug fix, not a format code commit.


if ($is_editor ||
$student_is_owner_of_work ||
Expand Down

0 comments on commit 00f3e4a

Please sign in to comment.