MDL-71728 mod_quiz: check if user can access this page

This commit is contained in:
Rajneel Totaram
2023-08-09 04:44:17 +00:00
committed by Jenkins
parent 323136eb1f
commit b0d1cef0e0
+6
View File
@@ -86,6 +86,12 @@ if ($attemptobj->is_finished()) {
throw new moodle_exception('attemptalreadyclosed', 'quiz', $attemptobj->view_url());
}
// If this page cannot be accessed, notify user and send them to the correct page.
if (!$finishattempt && !$attemptobj->check_page_access($thispage)) {
throw new moodle_exception('submissionoutofsequencefriendlymessage', 'question',
$attemptobj->attempt_url(null, $attemptobj->get_currentpage()));
}
// Process the attempt, getting the new status for the attempt.
$status = $attemptobj->process_attempt($timenow, $finishattempt, $timeup, $thispage);