interface AccessCheckInterface

An access check service determines access rules for particular routes.

Hierarchy

Expanded class hierarchy of AccessCheckInterface

All classes that implement AccessCheckInterface

20 files declare their use of AccessCheckInterface
AccessManagerTest.php in drupal/core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php
Contains \Drupal\Tests\Core\Access\AccessManagerTest.
CronAccessCheck.php in drupal/core/modules/system/lib/Drupal/system/Access/CronAccessCheck.php
Contains Drupal\system\Access\CronAccessCheck.
CSRFAccessCheck.php in drupal/core/modules/rest/lib/Drupal/rest/Access/CSRFAccessCheck.php
Contains Drupal\rest\Access\CSRFAccessCheck.
DefinedTestAccessCheck.php in drupal/core/modules/system/tests/modules/router_test/lib/Drupal/router_test/Access/DefinedTestAccessCheck.php
Contains \Drupal\router_test\Access\DefinedTestAccessCheck.
DeleteLinkAccessCheck.php in drupal/core/modules/menu/lib/Drupal/menu/Access/DeleteLinkAccessCheck.php
Contains \Drupal\menu\Access\DeleteLinkAccessCheck.

... See full list

File

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

Namespace

Drupal\Core\Access
View source
interface AccessCheckInterface {

  /**
   * Grant access.
   *
   * A checker should return this value to indicate that it grants access to a
   * route.
   */
  const ALLOW = TRUE;

  /**
   * Deny access.
   *
   * A checker should return this value to indicate it does not grant access to
   * a route.
   */
  const DENY = NULL;

  /**
   * Block access.
   *
   * A checker should return this value to indicate that it wants to completely
   * block access to this route, regardless of any other access checkers. Most
   * checkers should prefer DENY.
   */
  const KILL = FALSE;

  /**
   * Declares whether the access check applies to a specific route or not.
   *
   * @param \Symfony\Component\Routing\Route $route
   *   The route to consider attaching to.
   *
   * @return bool
   *   TRUE if the check applies to the passed route, FALSE otherwise.
   */
  public function applies(Route $route);

  /**
   * Checks for access to route.
   *
   * @param \Symfony\Component\Routing\Route $route
   *   The route to check against.
   * @param \Symfony\Component\HttpFoundation\Request $request
   *   The request object.
   *
   * @return mixed
   *   TRUE if access is allowed.
   *   FALSE if not.
   *   NULL if no opinion.
   */
  public function access(Route $route, Request $request);

}

Members

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