diff --git a/mod/assign/classes/courseformat/overview.php b/mod/assign/classes/courseformat/overview.php index e06e455bbe7..77d63d8a8d4 100644 --- a/mod/assign/classes/courseformat/overview.php +++ b/mod/assign/classes/courseformat/overview.php @@ -162,10 +162,7 @@ class overview extends \core_courseformat\activityoverviewbase { private function get_extra_submission_status_overview(): ?overviewitem { global $USER; - if ( - !has_capability('mod/assign:submit', $this->context) - || has_capability('moodle/site:config', $this->context) - ) { + if (!has_capability('mod/assign:submit', $this->context, $USER, false)) { return null; } diff --git a/mod/assign/tests/courseformat/overview_test.php b/mod/assign/tests/courseformat/overview_test.php index 7ce7bf87be0..2c2839e3c2b 100644 --- a/mod/assign/tests/courseformat/overview_test.php +++ b/mod/assign/tests/courseformat/overview_test.php @@ -258,6 +258,10 @@ final class overview_test extends \advanced_testcase { $method->setAccessible(true); $item = $method->invoke($overview); $this->assertNull($item); + // Unless the admin is enrolled as a student. + $this->getDataGenerator()->enrol_user(get_admin()->id, $course->id, 'student'); + $item = $method->invoke($overview); + $this->assertEquals(get_string('submissionstatus', 'assign'), $item->get_name()); // Check student see the new status. $this->setUser($student);