Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

(no description)

File Size: 875 lines (30 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: manager  - X-Ref

MFA management class.

display_debug_notification()   X-Ref
Displays a debug table with current factor information.

return: void

get_total_weight()   X-Ref
Returns the total weight from all factors currently enabled for user.

return: int

is_factorid_valid(int $factorid, object $user)   X-Ref
Checks that provided factorid exists and belongs to current user.

param: int $factorid
param: object $user
return: bool

cannot_login()   X-Ref
Function to display to the user that they cannot login, then log them out.

return: void

mfa_logout()   X-Ref
Logout user.

return: void

get_status()   X-Ref
Function to get the overall status of a user's authentication.

return: string a STATE variable from plugininfo

resolve_mfa_status(bool $shouldreload = false)   X-Ref
Function to check the overall status of a users authentication,
and perform any required actions.

param: bool $shouldreload whether the function should reload (used for auth.php).
return: void

passed_enough_factors()   X-Ref
Checks whether user has passed enough factors to be allowed in.

return: bool true if user has passed enough factors.

set_pass_state()   X-Ref
Sets the session variable for pass_state, if not already set.

return: void

update_pass_time()   X-Ref
Inserts or updates user's last MFA pass time in DB.
This should only be called from set_pass_state.

return: void

should_require_mfa(string|\moodle_url $url, bool|null $preventredirect)   X-Ref
Checks whether the user should be redirected from the provided url.

param: string|\moodle_url $url
param: bool|null $preventredirect
return: int

clear_redirect_counter()   X-Ref
Clears the redirect counter for infinite redirect loops. Called from auth.php when a valid load is resolved.

return: void

get_no_redirect_urls()   X-Ref
Gets all defined factor urls that should not redirect.

return: array

sleep_timer()   X-Ref
Sleeps for an increasing period of time.

return: void

require_auth($courseorid = null, $autologinguest = null, $cm = null,$setwantsurltome = null, $preventredirect = null)   X-Ref
If MFA Plugin is ready check tool_mfa_authenticated USER property and
start MFA authentication if it's not set or false.

param: mixed $courseorid
param: mixed $autologinguest
param: mixed $cm
param: mixed $setwantsurltome
param: mixed $preventredirect
return: void

set_factor_config(array $data, string $factor)   X-Ref
Sets config variable for given factor.

param: array $data
param: string $factor
return: bool true or exception

is_ready()   X-Ref
Checks if MFA Plugin is enabled and has enabled factor.
If plugin is disabled or there is no enabled factors,
it means there is nothing to do from user side.
Thus, login flow shouldn't be extended with MFA.

return: bool

do_factor_action(string $factorname, string $action)   X-Ref
Performs factor actions for given factor.
Change factor order and enable/disable.

param: string $factorname
param: string $action
return: void

possible_factor_setup()   X-Ref
Checks if a factor that can make a user pass can be setup.
It checks if a user will always pass regardless,
then checks if there are factors that can be setup to let a user pass.

return: bool

get_cumulative_weight()   X-Ref
Gets current user weight, up until first unknown factor.

return: int $totalweight Total weight of all factors.

check_factor_pending(string $factorname)   X-Ref
Checks whether the factor was actually used in the login process.

param: string $factorname the name of the factor.
return: bool true if factor is pending.