annotate core/lib/Drupal/Core/Access/AccessManagerInterface.php @ 19:fa3358dc1485 tip

Add ndrum files
author Chris Cannam
date Wed, 28 Aug 2019 13:14:47 +0100
parents 7a779792577d
children
rev   line source
Chris@0 1 <?php
Chris@0 2
Chris@0 3 namespace Drupal\Core\Access;
Chris@0 4
Chris@0 5 use Symfony\Component\HttpFoundation\Request;
Chris@0 6 use Drupal\Core\Session\AccountInterface;
Chris@0 7 use Drupal\Core\Routing\RouteMatchInterface;
Chris@0 8
Chris@0 9 /**
Chris@0 10 * Provides an interface for attaching and running access check services.
Chris@0 11 */
Chris@0 12 interface AccessManagerInterface {
Chris@0 13
Chris@0 14 /**
Chris@0 15 * Checks a named route with parameters against applicable access check services.
Chris@0 16 *
Chris@0 17 * Determines whether the route is accessible or not.
Chris@0 18 *
Chris@0 19 * @param string $route_name
Chris@0 20 * The route to check access to.
Chris@0 21 * @param array $parameters
Chris@0 22 * Optional array of values to substitute into the route path pattern.
Chris@0 23 * @param \Drupal\Core\Session\AccountInterface $account
Chris@0 24 * (optional) Run access checks for this account. Defaults to the current
Chris@0 25 * user.
Chris@0 26 * @param bool $return_as_object
Chris@0 27 * (optional) Defaults to FALSE.
Chris@0 28 *
Chris@0 29 * @return bool|\Drupal\Core\Access\AccessResultInterface
Chris@0 30 * The access result. Returns a boolean if $return_as_object is FALSE (this
Chris@0 31 * is the default) and otherwise an AccessResultInterface object.
Chris@0 32 * When a boolean is returned, the result of AccessInterface::isAllowed() is
Chris@0 33 * returned, i.e. TRUE means access is explicitly allowed, FALSE means
Chris@0 34 * access is either explicitly forbidden or "no opinion".
Chris@0 35 */
Chris@0 36 public function checkNamedRoute($route_name, array $parameters = [], AccountInterface $account = NULL, $return_as_object = FALSE);
Chris@0 37
Chris@0 38 /**
Chris@0 39 * Execute access checks against the incoming request.
Chris@0 40 *
Chris@12 41 * @param \Symfony\Component\HttpFoundation\Request $request
Chris@0 42 * The incoming request.
Chris@0 43 * @param \Drupal\Core\Session\AccountInterface $account
Chris@0 44 * (optional) Run access checks for this account. Defaults to the current
Chris@0 45 * user.
Chris@0 46 * @param bool $return_as_object
Chris@0 47 * (optional) Defaults to FALSE.
Chris@0 48 *
Chris@0 49 * @return bool|\Drupal\Core\Access\AccessResultInterface
Chris@0 50 * The access result. Returns a boolean if $return_as_object is FALSE (this
Chris@0 51 * is the default) and otherwise an AccessResultInterface object.
Chris@0 52 * When a boolean is returned, the result of AccessInterface::isAllowed() is
Chris@0 53 * returned, i.e. TRUE means access is explicitly allowed, FALSE means
Chris@0 54 * access is either explicitly forbidden or "no opinion".
Chris@0 55 */
Chris@0 56 public function checkRequest(Request $request, AccountInterface $account = NULL, $return_as_object = FALSE);
Chris@0 57
Chris@0 58 /**
Chris@0 59 * Checks a route against applicable access check services.
Chris@0 60 *
Chris@0 61 * Determines whether the route is accessible or not.
Chris@0 62 *
Chris@0 63 * @param \Drupal\Core\Routing\RouteMatchInterface $route_match
Chris@0 64 * The route match.
Chris@0 65 * @param \Drupal\Core\Session\AccountInterface $account
Chris@0 66 * (optional) Run access checks for this account. Defaults to the current
Chris@0 67 * user.
Chris@0 68 * @param \Symfony\Component\HttpFoundation\Request $request
Chris@0 69 * Optional, a request. Only supply this parameter when checking the
Chris@0 70 * incoming request, do not specify when checking routes on output.
Chris@0 71 * @param bool $return_as_object
Chris@0 72 * (optional) Defaults to FALSE.
Chris@0 73 *
Chris@0 74 * @return bool|\Drupal\Core\Access\AccessResultInterface
Chris@0 75 * The access result. Returns a boolean if $return_as_object is FALSE (this
Chris@0 76 * is the default) and otherwise an AccessResultInterface object.
Chris@0 77 * When a boolean is returned, the result of AccessInterface::isAllowed() is
Chris@0 78 * returned, i.e. TRUE means access is explicitly allowed, FALSE means
Chris@0 79 * access is either explicitly forbidden or "no opinion".
Chris@0 80 */
Chris@0 81 public function check(RouteMatchInterface $route_match, AccountInterface $account = NULL, Request $request = NULL, $return_as_object = FALSE);
Chris@0 82
Chris@0 83 }