Skip to content

Commit e8d4892

Browse files
committed
fixed edit permission check
1 parent 72a64d9 commit e8d4892

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/bundle/Controller/Content/ContentTreeController.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ private function getLocationPermissionRestrictions(Location $location): array
226226
'restrictedLanguageCodes' => $createLimitationsValues[Limitation::LANGUAGE],
227227
],
228228
'edit' => [
229-
'hasAccess' => $lookupUpdateLimitationsResult->hasAccess(),
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
],
@@ -325,6 +325,21 @@ private function isPreviewable(
325325

326326
return !empty($siteAccesses);
327327
}
328+
329+
/**
330+
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException
331+
* @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException
332+
*/
333+
private function canUserEditContent(Location $location): bool
334+
{
335+
$content = $location->getContent();
336+
337+
return $this->permissionResolver->canUser(
338+
'content',
339+
'edit',
340+
$content
341+
);
342+
}
328343
}
329344

330345
class_alias(ContentTreeController::class, 'EzSystems\EzPlatformAdminUiBundle\Controller\Content\ContentTreeController');

0 commit comments

Comments
 (0)