comparison core/modules/layout_builder/src/Access/LayoutPreviewAccessAllowed.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
comparison
equal deleted inserted replaced
16:c2387f117808 17:129ea1e6d783
1 <?php
2
3 namespace Drupal\layout_builder\Access;
4
5 use Drupal\Core\Access\AccessibleInterface;
6 use Drupal\Core\Access\AccessResult;
7 use Drupal\Core\Session\AccountInterface;
8
9 /**
10 * Accessible class to allow access for inline blocks in the Layout Builder.
11 *
12 * @internal
13 */
14 class LayoutPreviewAccessAllowed implements AccessibleInterface {
15
16 /**
17 * {@inheritdoc}
18 */
19 public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE) {
20 if ($operation === 'view') {
21 return $return_as_object ? AccessResult::allowed() : TRUE;
22 }
23 // The layout builder preview should only need 'view' access.
24 return $return_as_object ? AccessResult::forbidden() : FALSE;
25 }
26
27 }