public static function MoAuthUtilities::check_roles_to_invoke_2fa in Google Authenticator / 2 Factor Authentication - 2FA 8
Same name and namespace in other branches
- 8.2 src/MoAuthUtilities.php \Drupal\miniorange_2fa\MoAuthUtilities::check_roles_to_invoke_2fa()
1 call to MoAuthUtilities::check_roles_to_invoke_2fa()
File
- src/
MoAuthUtilities.php, line 250 - This file is part of miniOrange 2FA module.
Class
Namespace
Drupal\miniorange_2faCode
public static function check_roles_to_invoke_2fa($roles) {
$mo_auth_enable_role_based_2fa = \Drupal::config('miniorange_2fa.settings')
->get('mo_auth_enable_role_based_2fa');
$mo_auth_enable_use_only_2nd_factor = \Drupal::config('miniorange_2fa.settings')
->get('mo_auth_use_only_2nd_factor');
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(\Drupal::config('miniorange_2fa.settings')
->get('mo_auth_role_based_2fa_roles'));
foreach ($selected_roles as $sysName => $displayName) {
if (in_array($sysName, $roles, TRUE)) {
$return_value = TRUE;
break;
}
}
return $return_value;
}