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

This commit is contained in:
Rajneel Totaram 2023-04-20 18:54:37 +12:00 committed by Jenkins
parent efdf0e48c8
commit da05f15e3b

View File

@ -85,6 +85,12 @@ if ($attemptobj->is_finished()) {
'attemptalreadyclosed', null, $attemptobj->review_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);