public static function MoAuthUtilities::check_roles_to_invoke_2fa in Google Authenticator / 2 Factor Authentication - 2FA 7
1 call to MoAuthUtilities::check_roles_to_invoke_2fa()
File
- classes/
Utilities.php, line 135 - This file is part of miniOrange 2FA module.
Class
- MoAuthUtilities
- @file This file is part of miniOrange 2FA module.
Code
public static function check_roles_to_invoke_2fa($roles) {
$mo_auth_enable_role_based_2fa = variable_get('mo_auth_enable_role_based_2fa');
$mo_auth_enable_use_only_2nd_factor = variable_get('mo_auth_two_factor_instead_password');
if ($mo_auth_enable_role_based_2fa !== TRUE || $mo_auth_enable_use_only_2nd_factor === TRUE) {
return TRUE;
}
$return_value = FALSE;
$selected_roles = (array) json_decode(variable_get('mo_auth_role_based_2fa_roles'));
foreach ($selected_roles as $sysName => $displayName) {
if (in_array($displayName, $roles, TRUE)) {
$return_value = TRUE;
break;
}
}
return $return_value;
}