mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-37765 course: Add capability to ignore availability restrictions.
Allow a role to view activities without addressing the restriction rules.
This commit is contained in:
parent
216ea39be7
commit
6a36b8526e
8 changed files with 73 additions and 13 deletions
|
@ -110,7 +110,7 @@ class info_module extends info {
|
|||
}
|
||||
|
||||
protected function get_view_hidden_capability() {
|
||||
return 'moodle/course:viewhiddenactivities';
|
||||
return 'moodle/course:ignoreavailabilityrestrictions';
|
||||
}
|
||||
|
||||
public function get_user_list_sql($onlyactive = true) {
|
||||
|
|
|
@ -57,7 +57,7 @@ class info_section extends info {
|
|||
}
|
||||
|
||||
protected function get_view_hidden_capability() {
|
||||
return 'moodle/course:viewhiddensections';
|
||||
return 'moodle/course:ignoreavailabilityrestrictions';
|
||||
}
|
||||
|
||||
protected function set_in_database($availability) {
|
||||
|
|
2
availability/tests/fixtures/mock_info.php
vendored
2
availability/tests/fixtures/mock_info.php
vendored
|
@ -61,7 +61,7 @@ class mock_info extends info {
|
|||
}
|
||||
|
||||
protected function get_view_hidden_capability() {
|
||||
return 'moodle/course:viewhiddensections';
|
||||
return 'moodle/course:ignoreavailabilityrestrictions';
|
||||
}
|
||||
|
||||
protected function set_in_database($availability) {
|
||||
|
|
|
@ -492,7 +492,7 @@ class info_testcase extends advanced_testcase {
|
|||
// If the students have viewhiddenactivities, they get past the module
|
||||
// restriction.
|
||||
role_change_permission($studentroleid, context_module::instance($page2->cmid),
|
||||
'moodle/course:viewhiddenactivities', CAP_ALLOW);
|
||||
'moodle/course:ignoreavailabilityrestrictions', CAP_ALLOW);
|
||||
$expected = array($u1->id, $u2->id);
|
||||
$this->assertEquals($expected, array_keys($info->filter_user_list($allusers)));
|
||||
list ($sql, $params) = $info->get_user_list_sql(true);
|
||||
|
@ -503,7 +503,7 @@ class info_testcase extends advanced_testcase {
|
|||
// If they have viewhiddensections, they also get past the section
|
||||
// restriction.
|
||||
role_change_permission($studentroleid, context_course::instance($course->id),
|
||||
'moodle/course:viewhiddensections', CAP_ALLOW);
|
||||
'moodle/course:ignoreavailabilityrestrictions', CAP_ALLOW);
|
||||
$expected = array($u1->id, $u2->id, $u3->id);
|
||||
$this->assertEquals($expected, array_keys($info->filter_user_list($allusers)));
|
||||
list ($sql, $params) = $info->get_user_list_sql(true);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue