Mercurial > hg > isophonics-drupal-site
annotate core/modules/layout_builder/src/Access/LayoutBuilderAccessCheck.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | |
children | af1871eacc83 |
rev | line source |
---|---|
Chris@17 | 1 <?php |
Chris@17 | 2 |
Chris@17 | 3 namespace Drupal\layout_builder\Access; |
Chris@17 | 4 |
Chris@17 | 5 use Drupal\Core\Cache\RefinableCacheableDependencyInterface; |
Chris@17 | 6 use Drupal\Core\Routing\Access\AccessInterface; |
Chris@17 | 7 use Drupal\Core\Session\AccountInterface; |
Chris@17 | 8 use Drupal\layout_builder\SectionStorageInterface; |
Chris@17 | 9 use Symfony\Component\Routing\Route; |
Chris@17 | 10 |
Chris@17 | 11 /** |
Chris@17 | 12 * Provides an access check for the Layout Builder defaults. |
Chris@17 | 13 * |
Chris@17 | 14 * @internal |
Chris@17 | 15 */ |
Chris@17 | 16 class LayoutBuilderAccessCheck implements AccessInterface { |
Chris@17 | 17 |
Chris@17 | 18 /** |
Chris@17 | 19 * Checks routing access to the layout. |
Chris@17 | 20 * |
Chris@17 | 21 * @param \Drupal\layout_builder\SectionStorageInterface $section_storage |
Chris@17 | 22 * The section storage. |
Chris@17 | 23 * @param \Drupal\Core\Session\AccountInterface $account |
Chris@17 | 24 * The current user. |
Chris@17 | 25 * @param \Symfony\Component\Routing\Route $route |
Chris@17 | 26 * The route to check against. |
Chris@17 | 27 * |
Chris@17 | 28 * @return \Drupal\Core\Access\AccessResultInterface |
Chris@17 | 29 * The access result. |
Chris@17 | 30 */ |
Chris@17 | 31 public function access(SectionStorageInterface $section_storage, AccountInterface $account, Route $route) { |
Chris@17 | 32 $operation = $route->getRequirement('_layout_builder_access'); |
Chris@17 | 33 $access = $section_storage->access($operation, $account, TRUE); |
Chris@17 | 34 if ($access instanceof RefinableCacheableDependencyInterface) { |
Chris@17 | 35 $access->addCacheableDependency($section_storage); |
Chris@17 | 36 } |
Chris@17 | 37 return $access; |
Chris@17 | 38 } |
Chris@17 | 39 |
Chris@17 | 40 } |