Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

…ion downloads

Conflicts:
	mod/assign/locallib.php
  • Loading branch information...
commit 635216b08b40a3bdd074d71bb1f785ac38371aa6 1 parent c777836
@aolley aolley authored
Showing with 4 additions and 7 deletions.
  1. +4 −7 mod/assign/locallib.php
View
11 mod/assign/locallib.php
@@ -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) {
@@ -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)) {
@@ -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;
}
Please sign in to comment.
Something went wrong with that request. Please try again.