3 namespace Drupal\content_moderation;
5 use Drupal\Core\Access\AccessResult;
6 use Drupal\Core\Session\AccountInterface;
7 use Drupal\Core\Entity\EntityAccessControlHandler;
8 use Drupal\Core\Entity\EntityInterface;
11 * The access control handler for the content_moderation_state entity type.
13 * @see \Drupal\content_moderation\Entity\ContentModerationState
15 class ContentModerationStateAccessControlHandler extends EntityAccessControlHandler {
20 public function checkAccess(EntityInterface $entity, $operation, AccountInterface $account) {
21 // ContentModerationState is an internal entity type. Access is denied for
22 // viewing, updating, and deleting. In order to update an entity's
23 // moderation state use its moderation_state field.
24 return AccessResult::forbidden('ContentModerationState is an internal entity type.');
30 protected function checkCreateAccess(AccountInterface $account, array $context, $entity_bundle = NULL) {
31 // ContentModerationState is an internal entity type. Access is denied for
32 // creating. In order to update an entity's moderation state use its
33 // moderation_state field.
34 return AccessResult::forbidden('ContentModerationState is an internal entity type.');