class LoginStatusCheck

Determines access to routes based on login status of current user.

Hierarchy

Expanded class hierarchy of LoginStatusCheck

1 string reference to 'LoginStatusCheck'
user.services.yml in drupal/core/modules/user/user.services.yml
drupal/core/modules/user/user.services.yml
1 service uses LoginStatusCheck

File

drupal/core/modules/user/lib/Drupal/user/Access/LoginStatusCheck.php, line 17
Contains \Drupal\user\Access\LoginStatusCheck.

Namespace

Drupal\user\Access
View source
class LoginStatusCheck implements AccessCheckInterface {

  /**
   * {@inheritdoc}
   */
  public function applies(Route $route) {
    return array_key_exists('_user_is_logged_in', $route
      ->getRequirements());
  }

  /**
   * {@inheritdoc}
   */
  public function access(Route $route, Request $request) {
    return (bool) $GLOBALS['user']->uid;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AccessCheckInterface::ALLOW constant Grant access.
AccessCheckInterface::DENY constant Deny access.
AccessCheckInterface::KILL constant Block access.
LoginStatusCheck::access public function Checks for access to route. Overrides AccessCheckInterface::access
LoginStatusCheck::applies public function Declares whether the access check applies to a specific route or not. Overrides AccessCheckInterface::applies