MDL-25122 Quiz review page does not check and enforce separate groups mode.
This commit is contained in:
@@ -78,6 +78,16 @@
|
||||
redirect('view.php?q=' . $quiz->id, $message);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (!has_capability('moodle/site:accessallgroups', $context) &&
|
||||
groups_get_activity_groupmode($cm) == SEPARATEGROUPS) {
|
||||
// Check the users have at least one group in common.
|
||||
$teachersgroups = groups_get_activity_allowed_groups($cm);
|
||||
$studentsgroups = groups_get_all_groups($cm->course, $attempt->userid, $cm->groupingid);
|
||||
if (!($teachersgroups && $studentsgroups &&
|
||||
array_intersect(array_keys($teachersgroups), array_keys($studentsgroups)))) {
|
||||
print_error('noreview', 'quiz', 'view.php?q=' . $quiz->id);
|
||||
}
|
||||
}
|
||||
|
||||
/// Bits needed to print a good URL for this page.
|
||||
|
||||
@@ -80,6 +80,16 @@
|
||||
if ($attempt->userid != $USER->id) {
|
||||
error('This is not your attempt!');
|
||||
}
|
||||
|
||||
} else if (!has_capability('moodle/site:accessallgroups', $context) &&
|
||||
groups_get_activity_groupmode($cm) == SEPARATEGROUPS) {
|
||||
// Check the users have at least one group in common.
|
||||
$teachersgroups = groups_get_activity_allowed_groups($cm);
|
||||
$studentsgroups = groups_get_all_groups($cm->course, $attempt->userid, $cm->groupingid);
|
||||
if (!($teachersgroups && $studentsgroups &&
|
||||
array_intersect(array_keys($teachersgroups), array_keys($studentsgroups)))) {
|
||||
print_error('noreview', 'quiz', 'view.php?q=' . $quiz->id);
|
||||
}
|
||||
}
|
||||
|
||||
//add_to_log($course->id, 'quiz', 'review', "review.php?id=$cm->id&attempt=$attempt->id", "$quiz->id", "$cm->id");
|
||||
|
||||
Reference in New Issue
Block a user