"Fossies" - the Fresh Open Source Software Archive

Member "drupal-8.9.10/core/modules/content_moderation/src/ContentModerationStateAccessControlHandler.php" (26 Nov 2020, 1301 Bytes) of package /linux/www/drupal-8.9.10.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) PHP source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "ContentModerationStateAccessControlHandler.php" see the Fossies "Dox" file reference documentation.

    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 }