Merge branch 'MDL-84780-501' of https://github.com/sh-csg/moodle into MOODLE_501_STABLE

This commit is contained in:
Mihail Geshoski
2026-03-20 15:20:51 +08:00
2 changed files with 10 additions and 0 deletions
+4
View File
@@ -1653,6 +1653,10 @@ function course_allowed_module($course, $modname, ?\stdClass $user = null) {
supports numeric module ids. Please update your code to pass the module name.');
}
if (!\core\plugininfo\mod::get_enabled_plugin($modname)) {
return false;
}
$capability = 'mod/' . $modname . ':addinstance';
if (!get_capability_info($capability)) {
// Debug warning that the capability does not exist, but no more than once per page.
+6
View File
@@ -7295,6 +7295,12 @@ final class courselib_test extends advanced_testcase {
// Manager has permissions.
$this->assertTrue(course_allowed_module($course, 'assign', $manager));
// Disable the assign module.
$DB->set_field('modules', 'visible', 0, ['name' => 'assign']);
// Verify that disabled modules are not allowed.
$this->assertFalse(course_allowed_module($course, 'assign', $manager));
}
/**