public function PermissionAccessCheck::access

Implements AccessCheckInterface::access().

Overrides AccessCheckInterface::access

File

drupal/core/modules/user/lib/Drupal/user/Access/PermissionAccessCheck.php, line 29
Contains Drupal\user\Access\PermissionAccessCheck.

Class

PermissionAccessCheck
Determines access to routes based on permissions defined via hook_permission().

Namespace

Drupal\user\Access

Code

public function access(Route $route, Request $request) {
  $permission = $route
    ->getRequirement('_permission');

  // @todo Replace user_access() with a correctly injected and session-using
  //   alternative.
  // If user_access() fails, return NULL to give other checks a chance.
  return user_access($permission) ? static::ALLOW : static::DENY;
}