diff --git a/lib/db/access.php b/lib/db/access.php index 7b3a37a38e7..68704f4d66b 100644 --- a/lib/db/access.php +++ b/lib/db/access.php @@ -305,6 +305,10 @@ $capabilities = array( 'captype' => 'write', 'contextlevel' => CONTEXT_COURSE, + 'archetypes' => array( + 'editingteacher' => CAP_ALLOW, + 'manager' => CAP_ALLOW + ), ), 'moodle/restore:restoretargethub' => array( diff --git a/lib/filebrowser/tests/file_browser_test.php b/lib/filebrowser/tests/file_browser_test.php index 3ce057026f3..25835debed3 100644 --- a/lib/filebrowser/tests/file_browser_test.php +++ b/lib/filebrowser/tests/file_browser_test.php @@ -78,6 +78,10 @@ class file_browser_testcase extends advanced_testcase { $this->teacher = $this->getDataGenerator()->create_user(); $this->teacherrole = $DB->get_record('role', array('shortname' => 'editingteacher')); + + // Make sure we're testing what should be the default capabilities. + assign_capability('moodle/restore:viewautomatedfilearea', CAP_ALLOW, $this->teacherrole->id, $coursecontext1); + $this->getDataGenerator()->enrol_user($this->teacher->id, $this->course1->id, $this->teacherrole->id); $this->getDataGenerator()->enrol_user($this->teacher->id, $this->course2->id, $this->teacherrole->id); @@ -175,9 +179,9 @@ class file_browser_testcase extends advanced_testcase { // Filearea "Course summary" has a child that is the actual image file. $this->assertEquals($this->course1filerecord, $child->get_children()[0]->get_params()); - // There are six course-level file areas and no modules in this course. + // There are seven course-level file areas available to teachers with default caps and no modules in this course. $allchildren = $fileinfo->get_children(); - $this->assertEquals(6, count($allchildren)); + $this->assertEquals(7, count($allchildren)); $modulechildren = array_filter($allchildren, function($a) { return $a instanceof file_info_context_module; });