Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
|
Public Member Functions | |
check_combination (array $combination) | |
Checks whether the factor combination is valid based on factor behaviour. | |
delete_factor_for_user (stdClass $user) | |
Deletes all instances of a factor for user. | |
get_active_user_factors (stdClass $user) | |
Returns an array of active user factor records. | |
get_all_user_factors (stdClass $user) | |
Returns an array of all user factors of given type (both active and revoked). | |
get_display_name () | |
Returns factor name from language string. | |
get_info () | |
Returns factor info from language string. | |
get_label (int $factorid) | |
Retrieves label for a factorid. | |
get_lastverified (int $factorid) | |
Gets lastverified timestamp. | |
get_no_redirect_urls () | |
Returns a list of urls to not redirect from. | |
get_setup_string () | |
Gets the string for setup button on preferences page. | |
get_state () | |
Returns the state of the factor check. | |
get_summary_condition () | |
Return summary condition for passing factor. | |
get_weight () | |
Returns configured factor weight. | |
global_definition (\MoodleQuickForm $mform) | |
Hook point for global auth form action hooks. | |
global_definition_after_data (\MoodleQuickForm $mform) | |
Hook point for global auth form action hooks. | |
global_submit (object $data) | |
Hook point for global auth form action hooks. | |
global_validation (array $data, array $files) | |
Hook point for global auth form action hooks. | |
has_input () | |
Returns true if factor requires user input for success or failure during login. | |
has_revoke () | |
Returns true if factor class has factor records that might be revoked. | |
has_setup () | |
Returns true if factor needs to be setup by user and has setup_form. | |
is_enabled () | |
Returns true if factor is enabled, otherwise false. | |
login_form_definition (\MoodleQuickForm $mform) | |
Defines login form definition page for particular factor. | |
login_form_definition_after_data (\MoodleQuickForm $mform) | |
Defines login form definition page after form data has been set. | |
login_form_validation (array $data) | |
Implements login form validation for particular factor. | |
possible_states (stdClass $user) | |
Returns all possible states for a user. | |
post_pass_state () | |
Fires any additional actions required by the factor once the user reaches the pass state. | |
process_cancel_action () | |
Process a cancel action from a user. | |
revoke_user_factor (?int $factorid=null) | |
Marks factor record as revoked. | |
set_state (string $state) | |
Sets the state of the factor check into the session. | |
setup_factor_form_definition (\MoodleQuickForm $mform) | |
Defines setup_factor form definition page for particular factor. | |
setup_factor_form_definition_after_data (\MoodleQuickForm $mform) | |
Defines setup_factor form definition page after form data has been set. | |
setup_factor_form_validation (array $data) | |
Implements setup_factor form validation for particular factor. | |
setup_user_factor (stdClass $data) | |
Setups given factor and adds it to user's active factors list. | |
show_setup_buttons () | |
If has_setup returns true, decides if the setup buttons should be shown on the preferences page. | |
update_lastverified (?int $factorid=null) | |
When validation code is correct - update lastverified field for given factor. | |
tool_mfa\local\factor\object_factor::check_combination | ( | array | $combination | ) |
Checks whether the factor combination is valid based on factor behaviour.
E.g. a combination with nosetup and another factor is not valid, as you cannot pass nosetup with another factor.
array | $combination | array of factors that make up the combination |
bool |
Implemented in factor_grace\factor, factor_nosetup\factor, and tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::delete_factor_for_user | ( | stdClass | $user | ) |
Deletes all instances of a factor for user.
stdClass | $user | the user to delete for. |
void |
Implemented in tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::get_active_user_factors | ( | stdClass | $user | ) |
Returns an array of active user factor records.
Filters get_all_user_factors() output.
stdClass | $user | the user to check against. |
array |
Implemented in factor_grace\factor, and tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::get_all_user_factors | ( | stdClass | $user | ) |
Returns an array of all user factors of given type (both active and revoked).
stdClass | $user | the user to check against. |
array |
Implemented in factor_admin\factor, factor_auth\factor, factor_capability\factor, factor_cohort\factor, factor_email\factor, factor_grace\factor, factor_iprange\factor, factor_nosetup\factor, factor_role\factor, factor_token\factor, factor_webauthn\factor, and tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::get_display_name | ( | ) |
Returns factor name from language string.
string |
coding_exception |
Implemented in tool_mfa\local\factor\fallback, and tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::get_info | ( | ) |
Returns factor info from language string.
string |
coding_exception |
Implemented in tool_mfa\local\factor\fallback, and tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::get_label | ( | int | $factorid | ) |
Retrieves label for a factorid.
int | $factorid |
string|dml_exception |
Implemented in tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::get_lastverified | ( | int | $factorid | ) |
Gets lastverified timestamp.
int | $factorid |
int|bool |
Implemented in tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::get_no_redirect_urls | ( | ) |
Returns a list of urls to not redirect from.
array |
Implemented in factor_email\factor, factor_grace\factor, and tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::get_setup_string | ( | ) |
Gets the string for setup button on preferences page.
string | the string to display on the button. |
Implemented in factor_totp\factor, factor_webauthn\factor, and tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::get_state | ( | ) |
Returns the state of the factor check.
string |
Implemented in factor_admin\factor, factor_auth\factor, factor_capability\factor, factor_cohort\factor, factor_email\factor, factor_iprange\factor, factor_nosetup\factor, factor_role\factor, factor_token\factor, factor_totp\factor, factor_webauthn\factor, tool_mfa\local\factor\fallback, and tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::get_summary_condition | ( | ) |
Return summary condition for passing factor.
string |
Implemented in factor_auth\factor, factor_cohort\factor, factor_role\factor, and tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::get_weight | ( | ) |
Returns configured factor weight.
int |
dml_exception |
Implemented in tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::global_definition | ( | \MoodleQuickForm | $mform | ) |
Hook point for global auth form action hooks.
MoodleQuickForm | $mform | Form to inject global elements into. |
void |
Implemented in tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::global_definition_after_data | ( | \MoodleQuickForm | $mform | ) |
Hook point for global auth form action hooks.
MoodleQuickForm | $mform | Form to inject global elements into. |
void |
Implemented in tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::global_submit | ( | object | $data | ) |
Hook point for global auth form action hooks.
object | $data | Data from the form. |
void |
Implemented in tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::global_validation | ( | array | $data, |
array | $files ) |
Hook point for global auth form action hooks.
array | $data | Data from the form. |
array | $files | Files form the form. |
array | of errors from validation. |
Implemented in tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::has_input | ( | ) |
Returns true if factor requires user input for success or failure during login.
bool |
Implemented in factor_admin\factor, factor_auth\factor, factor_capability\factor, factor_cohort\factor, factor_email\factor, factor_grace\factor, factor_iprange\factor, factor_nosetup\factor, factor_role\factor, factor_token\factor, factor_webauthn\factor, and tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::has_revoke | ( | ) |
Returns true if factor class has factor records that might be revoked.
It means that user can revoke factor record from their profile.
bool |
Implemented in factor_totp\factor, factor_webauthn\factor, and tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::has_setup | ( | ) |
Returns true if factor needs to be setup by user and has setup_form.
bool |
Implemented in factor_totp\factor, factor_webauthn\factor, and tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::is_enabled | ( | ) |
Returns true if factor is enabled, otherwise false.
bool |
dml_exception |
Implemented in tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::login_form_definition | ( | \MoodleQuickForm | $mform | ) |
Defines login form definition page for particular factor.
MoodleQuickForm | $mform |
object\$mform |
coding_exception |
Implemented in factor_email\factor, factor_totp\factor, factor_webauthn\factor, and tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::login_form_definition_after_data | ( | \MoodleQuickForm | $mform | ) |
Defines login form definition page after form data has been set.
MoodleQuickForm | $mform |
object\$mform |
coding_exception |
Implemented in factor_email\factor, and tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::login_form_validation | ( | array | $data | ) |
Implements login form validation for particular factor.
Returns an array of errors, where array key = field id and array value = error text.
array | $data |
array |
Implemented in factor_email\factor, factor_totp\factor, factor_webauthn\factor, and tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::possible_states | ( | stdClass | $user | ) |
Returns all possible states for a user.
stdClass | $user |
array |
Implemented in factor_capability\factor, factor_cohort\factor, factor_email\factor, factor_grace\factor, factor_iprange\factor, factor_nosetup\factor, factor_role\factor, factor_token\factor, factor_totp\factor, factor_webauthn\factor, and tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::post_pass_state | ( | ) |
Fires any additional actions required by the factor once the user reaches the pass state.
void |
Implemented in factor_email\factor, factor_grace\factor, factor_token\factor, factor_totp\factor, and tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::process_cancel_action | ( | ) |
Process a cancel action from a user.
void |
Implemented in tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::revoke_user_factor | ( | ?int | $factorid = null | ) |
Marks factor record as revoked.
If factorid is not provided, revoke all instances of factor.
int | null | $factorid |
bool |
Implemented in tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::set_state | ( | string | $state | ) |
Sets the state of the factor check into the session.
Returns whether storing the var was successful.
string | $state |
bool |
Implemented in factor_auth\factor, factor_capability\factor, factor_cohort\factor, factor_grace\factor, factor_iprange\factor, factor_nosetup\factor, factor_role\factor, tool_mfa\local\factor\fallback, and tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::setup_factor_form_definition | ( | \MoodleQuickForm | $mform | ) |
Defines setup_factor form definition page for particular factor.
MoodleQuickForm | $mform |
object\$mform |
coding_exception |
Implemented in factor_totp\factor, factor_webauthn\factor, and tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::setup_factor_form_definition_after_data | ( | \MoodleQuickForm | $mform | ) |
Defines setup_factor form definition page after form data has been set.
MoodleQuickForm | $mform |
object\$mform |
coding_exception |
Implemented in factor_totp\factor, and tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::setup_factor_form_validation | ( | array | $data | ) |
Implements setup_factor form validation for particular factor.
Returns an array of errors, where array key = field id and array value = error text.
array | $data |
array |
Implemented in factor_totp\factor, and tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::setup_user_factor | ( | stdClass | $data | ) |
Setups given factor and adds it to user's active factors list.
Returns true if factor has been successfully added, otherwise false.
stdClass | $data |
stdClass|null | the factor record, or null. |
Implemented in factor_totp\factor, and tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::show_setup_buttons | ( | ) |
If has_setup returns true, decides if the setup buttons should be shown on the preferences page.
bool |
Implemented in factor_totp\factor, factor_webauthn\factor, and tool_mfa\local\factor\object_factor_base.
tool_mfa\local\factor\object_factor::update_lastverified | ( | ?int | $factorid = null | ) |
When validation code is correct - update lastverified field for given factor.
If factor id is not provided, update all factor entries for user.
int | null | $factorid |
bool|dml_exception |
Implemented in tool_mfa\local\factor\object_factor_base.