You are here

class DefinedTestAccessCheck in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/tests/modules/router_test_directory/src/Access/DefinedTestAccessCheck.php \Drupal\router_test\Access\DefinedTestAccessCheck

Defines an access checker similar to DefaultAccessCheck

Hierarchy

Expanded class hierarchy of DefinedTestAccessCheck

1 file declares its use of DefinedTestAccessCheck
AccessManagerTest.php in core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php
Contains \Drupal\Tests\Core\Access\AccessManagerTest.

File

core/modules/system/tests/modules/router_test_directory/src/Access/DefinedTestAccessCheck.php, line 17
Contains \Drupal\router_test\Access\DefinedTestAccessCheck.

Namespace

Drupal\router_test\Access
View source
class DefinedTestAccessCheck implements AccessInterface {

  /**
   * Checks access.
   *
   * @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('_test_access') === 'TRUE') {
      return AccessResult::allowed();
    }
    elseif ($route
      ->getRequirement('_test_access') === 'FALSE') {
      return AccessResult::forbidden();
    }
    else {
      return AccessResult::neutral();
    }
  }

}

Members