See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 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: | 398 lines (13 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
access_manager:: (24 methods):
__construct()
validate_browser_exam_key()
validate_config_key()
seb_required()
validate_basic_header()
is_using_seb()
can_bypass_seb()
get_this_page_url()
get_valid_config_key()
get_quiz()
is_allowed_browser_examkeys_configured()
check_browser_exam_keys()
check_key()
get_received_config_key()
get_received_browser_exam_key()
get_seb_use_type()
should_validate_basic_header()
should_validate_config_key()
should_validate_browser_exam_key()
set_session_access()
validate_session_access()
clear_session_access()
redirect_to_seb_config_link()
should_redirect_to_seb_config_link()
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_key(?string $browserexamkey = null, ?string $url = null) X-Ref |
Validate browser exam key. It will validate a provided browser exam key if provided, then will fall back to checking the header. param: string|null $browserexamkey Optional. Can validate a provided key, or will fall back to checking header. param: string|null $url Optionally provide URL of page to validate. return: bool |
validate_config_key(?string $configkey = null, ?string $url = null) X-Ref |
Validate a config key. It will check a provided config key if provided then will fall back to checking config key in header. param: string|null $configkey Optional. Can validate a provided key, or will fall back to checking header. param: string|null $url URL of page to validate. return: bool |
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 |
is_allowed_browser_examkeys_configured() X-Ref |
Check that at least one browser exam key exists in the quiz settings. return: bool True if one or more keys are set in quiz settings. |
check_browser_exam_keys(array $keys, string $header, ?string $url = null) 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. param: string|null $url URL of page to validate. return: bool True if the hash matches. |
check_key(string $validkey, string $key, ?string $url = null) X-Ref |
Check the hash from the request header against a single permitted key. param: string $validkey An allowed key. param: string $key The value of X-SafeExamBrowser-RequestHash, X-SafeExamBrowser-ConfigKeyHash or a provided key to check. param: string|null $url URL of page to validate. 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 |
set_session_access(bool $accessallowed) X-Ref |
Set session access for quiz. param: bool $accessallowed |
validate_session_access() X-Ref |
Check session access for quiz if already set. return: bool |
clear_session_access() X-Ref |
Unset the global session access variable for this quiz. |
redirect_to_seb_config_link() X-Ref |
Redirect to SEB config link. This will force Safe Exam Browser to be reconfigured. |
should_redirect_to_seb_config_link() X-Ref |
Check if we need to redirect to SEB config link. return: bool |