You are here

class DefaultAccessCheck in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Access/DefaultAccessCheck.php \Drupal\Core\Access\DefaultAccessCheck

Allows access to routes to be controlled by an '_access' boolean parameter.

Hierarchy

Expanded class hierarchy of DefaultAccessCheck

2 files declare their use of DefaultAccessCheck
AccessManagerTest.php in core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php
Contains \Drupal\Tests\Core\Access\AccessManagerTest.
DefaultAccessCheckTest.php in core/tests/Drupal/Tests/Core/Access/DefaultAccessCheckTest.php
Contains \Drupal\Tests\Core\Access\DefaultAccessCheckTest.
1 string reference to 'DefaultAccessCheck'
core.services.yml in core/core.services.yml
core/core.services.yml
1 service uses DefaultAccessCheck
access_check.default in core/core.services.yml
Drupal\Core\Access\DefaultAccessCheck

File

core/lib/Drupal/Core/Access/DefaultAccessCheck.php, line 16
Contains \Drupal\Core\Access\DefaultAccessCheck.

Namespace

Drupal\Core\Access
View source
class DefaultAccessCheck implements RoutingAccessInterface {

  /**
   * Checks access to the route based on the _access parameter.
   *
   * @param \Symfony\Component\Routing\Route $route
   *   The route to check against.
   *
   * @return \Drupal\Core\Access\AccessResultInterface
   *   The access result.
   */
  public function access(Route $route) {
    if ($route
      ->getRequirement('_access') === 'TRUE') {
      return AccessResult::allowed();
    }
    elseif ($route
      ->getRequirement('_access') === 'FALSE') {
      return AccessResult::forbidden();
    }
    else {
      return AccessResult::neutral();
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DefaultAccessCheck::access public function Checks access to the route based on the _access parameter.