Permalink
Browse files

MDL-25122 Quiz review page does not check and enforce separate groups…

… mode.
  • Loading branch information...
1 parent 0af9124 commit 8d5eaee1c9bea549215791cb84e68c94bab8d3fc @timhunt timhunt committed Feb 18, 2011
Showing with 20 additions and 0 deletions.
  1. +10 −0 mod/quiz/review.php
  2. +10 −0 mod/quiz/reviewquestion.php
View
@@ -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");

0 comments on commit 8d5eaee

Please sign in to comment.