You are here

public static function MoAuthUtilities::get_Existing_Drupal_Roles in Google Authenticator / 2 Factor Authentication - 2FA 8.2

Same name and namespace in other branches
  1. 8 src/MoAuthUtilities.php \Drupal\miniorange_2fa\MoAuthUtilities::get_Existing_Drupal_Roles()

Return value

array = All the roles available in the Drupal site

1 call to MoAuthUtilities::get_Existing_Drupal_Roles()
MoAuthLoginSettings::getRoleBased2faRoles in src/Form/MoAuthLoginSettings.php
Process role based 2FA

File

src/MoAuthUtilities.php, line 399
This file is part of miniOrange 2FA module.

Class

MoAuthUtilities

Namespace

Drupal\miniorange_2fa

Code

public static function get_Existing_Drupal_Roles() {
  $roles = Role::loadMultiple();
  $roles_arr = array();
  foreach ($roles as $key => $value) {

    /** Skip Anonymous user role **/
    if ($key == 'anonymous') {
      continue;
    }
    $roles_arr[$key] = $value
      ->label();
  }
  return $roles_arr;
}