You are here

protected function SocialAuthUserManager::isUserRoleDisabled in Social Auth 8

Checks if User with specific roles is allowed to login.

Parameters

\Drupal\user\UserInterface $drupal_user: User object to check if user has a specific role.

Return value

string|false The role that can't login. False if the user roles are not disabled.

1 call to SocialAuthUserManager::isUserRoleDisabled()
SocialAuthUserManager::authenticateExistingUser in src/SocialAuthUserManager.php
Authenticates and redirects existing users in authentication process.

File

src/SocialAuthUserManager.php, line 444

Class

SocialAuthUserManager
Contains all logic that is related to Drupal user management.

Namespace

Drupal\social_auth

Code

protected function isUserRoleDisabled(UserInterface $drupal_user) {
  foreach ($this->configFactory
    ->get('social_auth.settings')
    ->get('disabled_roles') as $role) {
    if ($drupal_user
      ->hasRole($role)) {
      return $role;
    }
  }
  return FALSE;
}