3 namespace Drupal\layout_builder\Access;
5 use Drupal\Core\Cache\RefinableCacheableDependencyInterface;
6 use Drupal\Core\Routing\Access\AccessInterface;
7 use Drupal\Core\Session\AccountInterface;
8 use Drupal\layout_builder\SectionStorageInterface;
9 use Symfony\Component\Routing\Route;
12 * Provides an access check for the Layout Builder defaults.
16 class LayoutBuilderAccessCheck implements AccessInterface {
19 * Checks routing access to the layout.
21 * @param \Drupal\layout_builder\SectionStorageInterface $section_storage
22 * The section storage.
23 * @param \Drupal\Core\Session\AccountInterface $account
25 * @param \Symfony\Component\Routing\Route $route
26 * The route to check against.
28 * @return \Drupal\Core\Access\AccessResultInterface
31 public function access(SectionStorageInterface $section_storage, AccountInterface $account, Route $route) {
32 $operation = $route->getRequirement('_layout_builder_access');
33 $access = $section_storage->access($operation, $account, TRUE);
34 if ($access instanceof RefinableCacheableDependencyInterface) {
35 $access->addCacheableDependency($section_storage);