AccessCheckInterface.php

Contains Drupal\Core\Access\AccessCheckInterface.

Namespace

Drupal\Core\Access

File

drupal/core/lib/Drupal/Core/Access/AccessCheckInterface.php
View source
  1. <?php
  2. /**
  3. * @file
  4. * Contains Drupal\Core\Access\AccessCheckInterface.
  5. */
  6. namespace Drupal\Core\Access;
  7. use Symfony\Component\Routing\Route;
  8. use Symfony\Component\HttpFoundation\Request;
  9. /**
  10. * An access check service determines access rules for particular routes.
  11. */
  12. interface AccessCheckInterface {
  13. /**
  14. * Grant access.
  15. *
  16. * A checker should return this value to indicate that it grants access to a
  17. * route.
  18. */
  19. const ALLOW = TRUE;
  20. /**
  21. * Deny access.
  22. *
  23. * A checker should return this value to indicate it does not grant access to
  24. * a route.
  25. */
  26. const DENY = NULL;
  27. /**
  28. * Block access.
  29. *
  30. * A checker should return this value to indicate that it wants to completely
  31. * block access to this route, regardless of any other access checkers. Most
  32. * checkers should prefer DENY.
  33. */
  34. const KILL = FALSE;
  35. /**
  36. * Declares whether the access check applies to a specific route or not.
  37. *
  38. * @param \Symfony\Component\Routing\Route $route
  39. * The route to consider attaching to.
  40. *
  41. * @return bool
  42. * TRUE if the check applies to the passed route, FALSE otherwise.
  43. */
  44. public function applies(Route $route);
  45. /**
  46. * Checks for access to route.
  47. *
  48. * @param \Symfony\Component\Routing\Route $route
  49. * The route to check against.
  50. * @param \Symfony\Component\HttpFoundation\Request $request
  51. * The request object.
  52. *
  53. * @return mixed
  54. * TRUE if access is allowed.
  55. * FALSE if not.
  56. * NULL if no opinion.
  57. */
  58. public function access(Route $route, Request $request);
  59. }

Interfaces

Namesort descending Description
AccessCheckInterface An access check service determines access rules for particular routes.