You are here

private function LoginFirewall::checkUserRestriction in Restrict Login or Role Access by IP Address 8.4

Validates the user IP restrictions, if set.

Parameters

AccountInterface $account: The user account to check IP restrictions against.

Return value

null|bool Null if there is no user restrictions. True/False whether the current users IP is in user IP whitelist.

1 call to LoginFirewall::checkUserRestriction()
LoginFirewall::isLoginAllowed in src/LoginFirewall.php
Checks that a user is allowed to login based on IP whitelists.

File

src/LoginFirewall.php, line 117

Class

LoginFirewall
Class LoginFirewall.

Namespace

Drupal\restrict_by_ip

Code

private function checkUserRestriction(AccountInterface $account) {
  $user_data = $this->config
    ->get('user.' . $account
    ->id());

  // If there is no user IP restriction configured, we allow all.
  if (strlen($user_data) == 0) {
    return NULL;
  }
  return $this
    ->checkIpRestriction($user_data);
}