MDL-23308, coursefiles repository plugin added
[moodle.git] / repository / lib.php
index eb21096..ed5e3dc 100644 (file)
@@ -739,6 +739,7 @@ abstract class repository {
                         $is_supported = false;
                     }
                 }
+
                 if (!$onlyvisible || ($repository->is_visible() && !$repository->disabled)) {
                     // check capability in current context
                     if (!empty($current_context)) {
@@ -746,6 +747,10 @@ abstract class repository {
                     } else {
                         $capability = has_capability('repository/'.$record->repositorytype.':view', get_system_context());
                     }
+                    if ($record->repositorytype == 'coursefiles') {
+                        // coursefiles plugin needs managefiles permission
+                        $capability = $capability && has_capability('moodle/course:managefiles', $current_context);
+                    }
                     if ($is_supported && $capability) {
                         $repositories[$repository->id] = $repository;
                     }