Skip to content

Commit b1b6ab3

Browse files
committed
small refactor of initial fix
1 parent 0a74ba6 commit b1b6ab3

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/bundle/Controller/Content/ContentTreeController.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class ContentTreeController extends RestController
4949

5050
private ConfigResolverInterface $configResolver;
5151

52-
private SiteaccessResolverInterface $siteaccessResolver;
52+
private SiteaccessResolverInterface $siteaccessResolver;
5353

5454
public function __construct(
5555
LocationService $locationService,
@@ -226,7 +226,7 @@ private function getLocationPermissionRestrictions(Location $location): array
226226
'restrictedLanguageCodes' => $createLimitationsValues[Limitation::LANGUAGE],
227227
],
228228
'edit' => [
229-
'hasAccess' => $this->canUserEditContent($location->getContent()),
229+
'hasAccess' => $this->canUserEditContent($location),
230230
// skipped content type limitation values as in this case it can be inferred from "hasAccess" above
231231
'restrictedLanguageCodes' => $updateLimitationsValues[Limitation::LANGUAGE],
232232
],
@@ -330,12 +330,13 @@ private function isPreviewable(
330330
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException
331331
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException
332332
*/
333-
private function canUserEditContent(Content $content): bool
333+
private function canUserEditContent(Location $location): bool
334334
{
335335
return $this->permissionResolver->canUser(
336336
'content',
337337
'edit',
338-
$content
338+
$location->getContent(),
339+
[$location]
339340
);
340341
}
341342
}

0 commit comments

Comments
 (0)