X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fmodules%2Fcontrib%2Fparagraphs%2Fsrc%2FParagraphAccessControlHandler.php;fp=web%2Fmodules%2Fcontrib%2Fparagraphs%2Fsrc%2FParagraphAccessControlHandler.php;h=9168590c414e5357e10ffbd793553b24c8a5dab3;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hp=d49c368f9453ba35e44bb947f3c6ef063b55e222;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0;p=yaffs-website diff --git a/web/modules/contrib/paragraphs/src/ParagraphAccessControlHandler.php b/web/modules/contrib/paragraphs/src/ParagraphAccessControlHandler.php index d49c368f9..9168590c4 100644 --- a/web/modules/contrib/paragraphs/src/ParagraphAccessControlHandler.php +++ b/web/modules/contrib/paragraphs/src/ParagraphAccessControlHandler.php @@ -20,15 +20,18 @@ class ParagraphAccessControlHandler extends EntityAccessControlHandler { protected function checkAccess(EntityInterface $paragraph, $operation, AccountInterface $account) { // Allowed when the operation is not view or the status is true. /** @var \Drupal\paragraphs\Entity\Paragraph $paragraph */ + $access_result = AccessResult::allowedIf($operation != 'view' || $paragraph->status->value); if ($paragraph->getParentEntity() != NULL) { // Delete permission on the paragraph, should just depend on 'update' // access permissions on the parent. $operation = ($operation == 'delete') ? 'update' : $operation; - $parent_access = $paragraph->getParentEntity()->access($operation, $account, TRUE); - return AccessResult::allowedIf($operation != 'view' || $paragraph->status->value) - ->andIf($parent_access); + // Library items have no support for parent entity access checking. + if ($paragraph->getParentEntity()->getEntityTypeId() != 'paragraphs_library_item') { + $parent_access = $paragraph->getParentEntity()->access($operation, $account, TRUE); + $access_result = $access_result->andIf($parent_access); + } } - return AccessResult::allowedIf($operation != 'view' || $paragraph->status->value); + return $access_result; } /**