Browse files

Merge branch 'MDL-36897_22' of git://github.com/timhunt/moodle into M…

…OODLE_22_STABLE
  • Loading branch information...
2 parents 3b36eaa + 7192907 commit e93213e2e03248689efa0b7597d78d539639b897 @danpoltawski danpoltawski committed Dec 11, 2012
Showing with 6 additions and 2 deletions.
  1. +6 −2 mod/quiz/summary.php
View
8 mod/quiz/summary.php
@@ -36,9 +36,13 @@
// Check login.
require_login($attemptobj->get_course(), false, $attemptobj->get_cm());
-// If this is not our own attempt, display an error.
+// Check that this attempt belongs to this user.
if ($attemptobj->get_userid() != $USER->id) {
- print_error('notyourattempt', 'quiz', $attemptobj->view_url());
+ if ($attemptobj->has_capability('mod/quiz:viewreports')) {
+ redirect($attemptobj->review_url(null, $page));
+ } else {
+ throw new moodle_quiz_exception($attemptobj->get_quizobj(), 'notyourattempt');
+ }
}
// Check capabilites.

0 comments on commit e93213e

Please sign in to comment.