Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/content_moderation/src/ContentModerationStateAccessControlHandler.php @ 0:c75dbcec494b
Initial commit from drush-created site
author | Chris Cannam |
---|---|
date | Thu, 05 Jul 2018 14:24:15 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c75dbcec494b |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\content_moderation; | |
4 | |
5 use Drupal\Core\Access\AccessResult; | |
6 use Drupal\Core\Session\AccountInterface; | |
7 use Drupal\Core\Entity\EntityAccessControlHandler; | |
8 use Drupal\Core\Entity\EntityInterface; | |
9 | |
10 /** | |
11 * The access control handler for the content_moderation_state entity type. | |
12 * | |
13 * @see \Drupal\content_moderation\Entity\ContentModerationState | |
14 */ | |
15 class ContentModerationStateAccessControlHandler extends EntityAccessControlHandler { | |
16 | |
17 /** | |
18 * {@inheritdoc} | |
19 */ | |
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.'); | |
25 } | |
26 | |
27 /** | |
28 * {@inheritdoc} | |
29 */ | |
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.'); | |
35 } | |
36 | |
37 } |