diff core/modules/block_content/src/BlockContentAccessControlHandler.php @ 0:4c8ae668cc8c

Initial import (non-working)
author Chris Cannam
date Wed, 29 Nov 2017 16:09:58 +0000
parents
children 1fec387a4317
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/core/modules/block_content/src/BlockContentAccessControlHandler.php	Wed Nov 29 16:09:58 2017 +0000
@@ -0,0 +1,27 @@
+<?php
+
+namespace Drupal\block_content;
+
+use Drupal\Core\Access\AccessResult;
+use Drupal\Core\Entity\EntityInterface;
+use Drupal\Core\Entity\EntityAccessControlHandler;
+use Drupal\Core\Session\AccountInterface;
+
+/**
+ * Defines the access control handler for the custom block entity type.
+ *
+ * @see \Drupal\block_content\Entity\BlockContent
+ */
+class BlockContentAccessControlHandler extends EntityAccessControlHandler {
+
+  /**
+   * {@inheritdoc}
+   */
+  protected function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
+    if ($operation === 'view') {
+      return AccessResult::allowed();
+    }
+    return parent::checkAccess($entity, $operation, $account);
+  }
+
+}