Permalink
Browse files

MDL-38655: mod_assign: Use correct ordering on cap checks for submiss…

…ion downloads
  • Loading branch information...
1 parent 7bc37de commit 6e3013be7cfdd734fabf324ef903a2803e73f193 @aolley aolley committed Apr 18, 2013
Showing with 5 additions and 5 deletions.
  1. +5 −5 mod/assign/locallib.php
View
10 mod/assign/locallib.php
@@ -2692,12 +2692,12 @@ private function is_graded($userid) {
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) {
@@ -2716,7 +2716,7 @@ public function can_view_group_submission($groupid) {
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)) {
@@ -2725,7 +2725,7 @@ public function can_view_submission($userid) {
if ($userid == $USER->id && !has_capability('mod/assign:submit', $this->context)) {
return false;
}
- if ($userid != $USER->id && !has_capability('mod/assign:grade', $this->context)) {
+ if ($userid != $USER->id) {
return false;
}
return true;

0 comments on commit 6e3013b

Please sign in to comment.