Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 311 and 400] [Versions 311 and 401]

Manage the access to the quiz.

Author: Tim Hunt
Author: Luca Bösch <luca.boesch@bfh.ch>
Author: Andrew Madden <andrewmadden@catalyst-au.net>
Author: Dmitrii Metelkin <dmitriim@catalyst-au.net>
Copyright: 2019 Catalyst IT
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 300 lines (9 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: access_manager  - X-Ref

Manage the access to the quiz.

__construct(quiz $quiz)   X-Ref
The access_manager constructor.

param: quiz $quiz The details of the quiz.

validate_browser_exam_keys()   X-Ref
Check if the browser exam key hash in header matches one of the listed browser exam keys from quiz settings.

return: bool True if header key matches one of the saved keys.

validate_config_key()   X-Ref
Check if the config key hash in header matches quiz settings.

return: bool True if header key matches saved key.

seb_required()   X-Ref
Check if Safe Exam Browser is required to access quiz.
If quizsettings do not exist, then there is no requirement for using SEB.

return: bool If required.

validate_basic_header()   X-Ref
This is the basic check for the Safe Exam Browser previously used in the quizaccess_safebrowser plugin that
managed basic Moodle interactions with SEB.

return: bool

is_using_seb()   X-Ref
Check if using Safe Exam Browser.

return: bool

can_bypass_seb()   X-Ref
Check if user has any capability to bypass the Safe Exam Browser requirement.

return: bool True if user can bypass check.

get_this_page_url()   X-Ref
Return the full URL that was used to request the current page, which is
what we need for verifying the X-SafeExamBrowser-RequestHash header.


get_valid_config_key()   X-Ref
Return expected SEB config key.

return: string|null

get_quiz()   X-Ref
Getter for the quiz object.

return: quiz

check_browser_exam_keys(array $keys, string $header)   X-Ref
Check the hash from the request header against the permitted browser exam keys.

param: array $keys Allowed browser exam keys.
param: string $header The value of the X-SafeExamBrowser-RequestHash to check.
return: bool True if the hash matches.

check_key($key, $header)   X-Ref
Check the hash from the request header against a single permitted key.

param: string $key an allowed key.
param: string $header the value of the X-SafeExamBrowser-RequestHash or X-SafeExamBrowser-ConfigKeyHash to check.
return: bool true if the hash matches.

get_received_config_key()   X-Ref
Returns Safe Exam Browser Config Key hash.

return: string|null

get_received_browser_exam_key()   X-Ref
Returns the Browser Exam Key hash.

return: string|null

get_seb_use_type()   X-Ref
Get type of SEB usage for the quiz.

return: int

should_validate_basic_header()   X-Ref
Should validate basic header?

return: bool

should_validate_config_key()   X-Ref
Should validate SEB config key?

return: bool

should_validate_browser_exam_key()   X-Ref
Should validate browser exam key?

return: bool