Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / layout_builder / src / Access / LayoutPreviewAccessAllowed.php
diff --git a/web/core/modules/layout_builder/src/Access/LayoutPreviewAccessAllowed.php b/web/core/modules/layout_builder/src/Access/LayoutPreviewAccessAllowed.php
new file mode 100644 (file)
index 0000000..6754e2b
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+namespace Drupal\layout_builder\Access;
+
+use Drupal\Core\Access\AccessibleInterface;
+use Drupal\Core\Access\AccessResult;
+use Drupal\Core\Session\AccountInterface;
+
+/**
+ * Accessible class to allow access for inline blocks in the Layout Builder.
+ *
+ * @internal
+ */
+class LayoutPreviewAccessAllowed implements AccessibleInterface {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function access($operation, AccountInterface $account = NULL, $return_as_object = FALSE) {
+    if ($operation === 'view') {
+      return $return_as_object ? AccessResult::allowed() : TRUE;
+    }
+    // The layout builder preview should only need 'view' access.
+    return $return_as_object ? AccessResult::forbidden() : FALSE;
+  }
+
+}