Visible modules in a hidden section are accessible by students (users without moodle/course:viewhiddensections capability).
Related to MDL-35568, when you drag and drop content into a hidden section the content isn't initially hidden.
However, you can also edit content in a hidden section to be visible.
The fix that we just deployed in production is to edit obtain_dynamic_data in lib/modinfolib.php to add in the following check after the main if/else block:
// check parent section visible as well
|
if (!isset($parentsection)) {
|
// might have been queried earlier
|
$parentsection = $this->modinfo->get_section_info($this->sectionnum);
|
}
|
if (!$parentsection->visible) {
|
// Do not store info from section here, as that is already
|
// presented from the section (if appropriate) - just change
|
// the flag
|
$this->available = false;
|
}
|
But the thing is that the course modules are shown as visible, but really aren't by students.
Maybe an event trigger to respond to mod_created/mod_updated events and check the module's parent section. If not visible, then set that module's visibility to that as well?
- has a non-specific relationship to
-
MDL-35568 Creating new resources via DND in a hidden section sets visibility incorrectly
-
- Closed
-
-
MDL-31563 When changing a course section number to lower values, conten in the rest of the sections remains but is hidden
-
- Closed
-
- has been marked as being related by
-
MDL-35663 Option to disable unhidden activities in sections hidden from students
-
- Closed
-
-
MDL-13966 add ability to prevent access to Resources/activities in non-shown sections
-
- Closed
-
- is duplicated by
-
MDL-43616 Hidden activities can still be made "visible" through their settings page
-
- Closed
-