3 namespace Drupal\Core\Access;
5 use Symfony\Component\Routing\RouteCollection;
8 * Provides the available access checkers by service IDs.
10 * Access checker services are added by ::addCheckService calls and are loaded
13 * The checker provider service and the actual checking is separated in order
14 * to not require the full access manager on route build time.
16 interface CheckProviderInterface {
19 * For each route, saves a list of applicable access checks to the route.
21 * @param \Symfony\Component\Routing\RouteCollection $routes
22 * A collection of routes to apply checks to.
24 public function setChecks(RouteCollection $routes);
27 * Registers a new AccessCheck by service ID.
29 * @param string $service_id
30 * The ID of the service in the Container that provides a check.
31 * @param string $service_method
32 * The method to invoke on the service object for performing the check.
33 * @param array $applies_checks
34 * (optional) An array of route requirement keys the checker service applies
36 * @param bool $needs_incoming_request
37 * (optional) True if access-check method only acts on an incoming request.
39 public function addCheckService($service_id, $service_method, array $applies_checks = [], $needs_incoming_request = FALSE);
42 * Lazy-loads access check services.
44 * @param string $service_id
45 * The service id of the access check service to load.
48 * A callable access check.
50 * @throws \InvalidArgumentException
51 * Thrown when the service hasn't been registered in addCheckService().
52 * @throws \Drupal\Core\Access\AccessException
53 * Thrown when the service doesn't implement the required interface.
55 public function loadCheck($service_id);
58 * A list of checks that needs the request.
62 public function getChecksNeedRequest();