Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-30891 fix invalid hardcoded capability check when disable legacy …

…files repo
  • Loading branch information...
commit 5f4ed5d18a55567cb40901bb838b22f24c9c3094 1 parent c1dc3a5
@skodak skodak authored
Showing with 5 additions and 1 deletion.
  1. +5 −1 repository/lib.php
View
6 repository/lib.php
@@ -869,7 +869,11 @@ public static function get_instances($args = array()) {
}
if ($record->repositorytype == 'coursefiles') {
// coursefiles plugin needs managefiles permission
- $capability = $capability && has_capability('moodle/course:managefiles', $current_context);
+ if (!empty($current_context)) {
+ $capability = $capability && has_capability('moodle/course:managefiles', $current_context);
+ } else {
+ $capability = $capability && has_capability('moodle/course:managefiles', get_system_context());
+ }
}
if ($is_supported && $capability) {
$repositories[$repository->id] = $repository;
Please sign in to comment.
Something went wrong with that request. Please try again.