comparison core/lib/Drupal/Core/Access/CheckProviderInterface.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children 129ea1e6d783
comparison
equal deleted inserted replaced
-1:000000000000 0:4c8ae668cc8c
1 <?php
2
3 namespace Drupal\Core\Access;
4
5 use Symfony\Component\Routing\RouteCollection;
6
7 /**
8 * Provides the available access checkers by service IDs.
9 *
10 * Access checker services are added by ::addCheckService calls and are loaded
11 * by ::loadCheck.
12 *
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.
15 */
16 interface CheckProviderInterface {
17
18
19 /**
20 * For each route, saves a list of applicable access checks to the route.
21 *
22 * @param \Symfony\Component\Routing\RouteCollection $routes
23 * A collection of routes to apply checks to.
24 */
25 public function setChecks(RouteCollection $routes);
26
27 /**
28 * Registers a new AccessCheck by service ID.
29 *
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
36 * to.
37 * @param bool $needs_incoming_request
38 * (optional) True if access-check method only acts on an incoming request.
39 */
40 public function addCheckService($service_id, $service_method, array $applies_checks = [], $needs_incoming_request = FALSE);
41
42 /**
43 * Lazy-loads access check services.
44 *
45 * @param string $service_id
46 * The service id of the access check service to load.
47 *
48 * @return callable
49 * A callable access check.
50 *
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.
55 */
56 public function loadCheck($service_id);
57
58 /**
59 * A list of checks that needs the request.
60 *
61 * @return array
62 */
63 public function getChecksNeedRequest();
64
65 }