Skip to content

Commit

Permalink
MDL-38655: mod_assign: Use correct ordering on cap checks for submiss…
Browse files Browse the repository at this point in the history
…ion downloads

Conflicts:
	mod/assign/locallib.php
  • Loading branch information
aolley committed Oct 4, 2013
1 parent c777836 commit 635216b
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions mod/assign/locallib.php
Expand Up @@ -3086,12 +3086,12 @@ protected 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) {
Expand All @@ -3110,7 +3110,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)) {
Expand All @@ -3119,9 +3119,6 @@ public function can_view_submission($userid) {
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;
}

Expand Down

0 comments on commit 635216b

Please sign in to comment.