Mercurial > hg > cmmr2012-drupal-site
diff core/modules/layout_builder/src/Access/LayoutBuilderAccessCheck.php @ 5:12f9dff5fda9 tip
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:34:47 +0100 |
parents | a9cd425dd02b |
children |
line wrap: on
line diff
--- a/core/modules/layout_builder/src/Access/LayoutBuilderAccessCheck.php Thu Feb 28 13:11:55 2019 +0000 +++ b/core/modules/layout_builder/src/Access/LayoutBuilderAccessCheck.php Thu May 09 15:34:47 2019 +0100 @@ -2,6 +2,7 @@ namespace Drupal\layout_builder\Access; +use Drupal\Core\Access\AccessResult; use Drupal\Core\Cache\RefinableCacheableDependencyInterface; use Drupal\Core\Routing\Access\AccessInterface; use Drupal\Core\Session\AccountInterface; @@ -11,7 +12,10 @@ /** * Provides an access check for the Layout Builder defaults. * + * @ingroup layout_builder_access + * * @internal + * Tagged services are internal. */ class LayoutBuilderAccessCheck implements AccessInterface { @@ -31,6 +35,13 @@ public function access(SectionStorageInterface $section_storage, AccountInterface $account, Route $route) { $operation = $route->getRequirement('_layout_builder_access'); $access = $section_storage->access($operation, $account, TRUE); + + // Check for the global permission unless the section storage checks + // permissions itself. + if (!$section_storage->getPluginDefinition()->get('handles_permission_check')) { + $access = $access->andIf(AccessResult::allowedIfHasPermission($account, 'configure any layout')); + } + if ($access instanceof RefinableCacheableDependencyInterface) { $access->addCacheableDependency($section_storage); }