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 {
20 * For each route, saves a list of applicable access checks to the route.
22 * @param \Symfony\Component\Routing\RouteCollection $routes
23 * A collection of routes to apply checks to.
25 public function setChecks(RouteCollection $routes);
28 * Registers a new AccessCheck by service ID.
30 * @param string $service_id
31 * The ID of the service in the Container that provides a check.
32 * @param string $service_method
33 * The method to invoke on the service object for performing the check.
34 * @param array $applies_checks
35 * (optional) An array of route requirement keys the checker service applies
37 * @param bool $needs_incoming_request
38 * (optional) True if access-check method only acts on an incoming request.
40 public function addCheckService($service_id, $service_method, array $applies_checks = [], $needs_incoming_request = FALSE);
43 * Lazy-loads access check services.
45 * @param string $service_id
46 * The service id of the access check service to load.
49 * A callable access check.
51 * @throws \InvalidArgumentException
52 * Thrown when the service hasn't been registered in addCheckService().
53 * @throws \Drupal\Core\Access\AccessException
54 * Thrown when the service doesn't implement the required interface.
56 public function loadCheck($service_id);
59 * A list of checks that needs the request.
63 public function getChecksNeedRequest();