From 635216b08b40a3bdd074d71bb1f785ac38371aa6 Mon Sep 17 00:00:00 2001 From: Adam Olley Date: Thu, 18 Apr 2013 14:16:25 +0930 Subject: [PATCH] MDL-38655: mod_assign: Use correct ordering on cap checks for submission downloads Conflicts: mod/assign/locallib.php --- mod/assign/locallib.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/mod/assign/locallib.php b/mod/assign/locallib.php index 3af88b86b2b..fd5fe205251 100644 --- a/mod/assign/locallib.php +++ b/mod/assign/locallib.php @@ -3086,12 +3086,12 @@ class assign { public function can_view_group_submission($groupid) { global $USER; - if (!is_enrolled($this->get_course_context(), $USER->id)) { - return false; - } if (has_capability('mod/assign:grade', $this->context)) { return true; } + if (!is_enrolled($this->get_course_context(), $USER->id)) { + return false; + } $members = $this->get_submission_group_members($groupid, true); foreach ($members as $member) { if ($member->id == $USER->id) { @@ -3110,7 +3110,7 @@ class assign { public function can_view_submission($userid) { global $USER; - if (is_siteadmin()) { + if (has_capability('mod/assign:grade', $this->context)) { return true; } if (!is_enrolled($this->get_course_context(), $userid)) { @@ -3119,9 +3119,6 @@ class assign { if ($userid == $USER->id && has_capability('mod/assign:submit', $this->context)) { return true; } - if (has_capability('mod/assign:grade', $this->context)) { - return true; - } return false; }