diff --git a/src/bundle/Controller/Content/ContentTreeController.php b/src/bundle/Controller/Content/ContentTreeController.php index 92ad117f4f..4d04c34ece 100644 --- a/src/bundle/Controller/Content/ContentTreeController.php +++ b/src/bundle/Controller/Content/ContentTreeController.php @@ -49,7 +49,7 @@ class ContentTreeController extends RestController private ConfigResolverInterface $configResolver; - private SiteaccessResolverInterface $siteaccessResolver; + private SiteaccessResolverInterface $siteaccessResolver; public function __construct( LocationService $locationService, @@ -226,7 +226,7 @@ private function getLocationPermissionRestrictions(Location $location): array 'restrictedLanguageCodes' => $createLimitationsValues[Limitation::LANGUAGE], ], 'edit' => [ - 'hasAccess' => $lookupUpdateLimitationsResult->hasAccess(), + 'hasAccess' => $this->canUserEditContent($location), // skipped content type limitation values as in this case it can be inferred from "hasAccess" above 'restrictedLanguageCodes' => $updateLimitationsValues[Limitation::LANGUAGE], ], @@ -325,6 +325,20 @@ private function isPreviewable( return !empty($siteAccesses); } + + /** + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException + * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException + */ + private function canUserEditContent(Location $location): bool + { + return $this->permissionResolver->canUser( + 'content', + 'edit', + $location->getContent(), + [$location] + ); + } } class_alias(ContentTreeController::class, 'EzSystems\EzPlatformAdminUiBundle\Controller\Content\ContentTreeController');