diff --git a/mod/bigbluebuttonbn/classes/local/helpers/files.php b/mod/bigbluebuttonbn/classes/local/helpers/files.php index dddce8d1b520a..19730cd3779fb 100644 --- a/mod/bigbluebuttonbn/classes/local/helpers/files.php +++ b/mod/bigbluebuttonbn/classes/local/helpers/files.php @@ -251,9 +251,12 @@ public static function get_plugin_filename(?stdClass $course, ?stdClass $cm, con } else { require_login(null, true, $cm, true, true); } - if (!has_capability('mod/bigbluebuttonbn:join', $context)) { + + // If the file belongs to a course module, ensure user can join the activity. + if ($cm !== null && !has_capability('mod/bigbluebuttonbn:join', $context)) { return null; } + return implode('/', $args); }