mirror of
https://github.com/moodle/moodle.git
synced 2025-01-30 03:58:34 +01:00
MDL-61115: mod_lesson: Check if the teacher can access the override
This commit is contained in:
parent
b392686a65
commit
eb70df6f4b
@ -49,6 +49,16 @@ require_login($course, false, $cm);
|
||||
// Check the user has the required capabilities to modify an override.
|
||||
require_capability('mod/lesson:manageoverrides', $context);
|
||||
|
||||
if ($override->groupid) {
|
||||
if (!groups_group_visible($override->groupid, $course, $cm)) {
|
||||
print_error('invalidoverrideid', 'lesson');
|
||||
}
|
||||
} else {
|
||||
if (!groups_user_groups_visible($course, $override->userid, $cm)) {
|
||||
print_error('invalidoverrideid', 'lesson');
|
||||
}
|
||||
}
|
||||
|
||||
$url = new moodle_url('/mod/lesson/overridedelete.php', array('id' => $override->id));
|
||||
$confirmurl = new moodle_url($url, array('id' => $override->id, 'confirm' => 1));
|
||||
$cancelurl = new moodle_url('/mod/lesson/overrides.php', array('cmid' => $cm->id));
|
||||
|
@ -76,6 +76,16 @@ require_capability('mod/lesson:manageoverrides', $context);
|
||||
if ($overrideid) {
|
||||
// Editing an override.
|
||||
$data = clone $override;
|
||||
|
||||
if ($override->groupid) {
|
||||
if (!groups_group_visible($override->groupid, $course, $cm)) {
|
||||
print_error('invalidoverrideid', 'lesson');
|
||||
}
|
||||
} else {
|
||||
if (!groups_user_groups_visible($course, $override->userid, $cm)) {
|
||||
print_error('invalidoverrideid', 'lesson');
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Creating a new override.
|
||||
$data = new stdClass();
|
||||
|
Loading…
x
Reference in New Issue
Block a user