From 606de2812c853549a08f84e6f283b4fe0a3f076f Mon Sep 17 00:00:00 2001 From: Andrew Longosz Date: Wed, 20 Sep 2017 13:18:59 +0200 Subject: [PATCH] EZP-27886: Fixed wrong policy function name for removeTranslation (#2092) --- eZ/Publish/API/Repository/Tests/ContentServiceTest.php | 2 +- eZ/Publish/Core/Repository/ContentService.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eZ/Publish/API/Repository/Tests/ContentServiceTest.php b/eZ/Publish/API/Repository/Tests/ContentServiceTest.php index 37ceb855221..e90ed0cc195 100644 --- a/eZ/Publish/API/Repository/Tests/ContentServiceTest.php +++ b/eZ/Publish/API/Repository/Tests/ContentServiceTest.php @@ -5325,7 +5325,7 @@ public function testRemoveTranslationLastLanguageThrowsBadStateException() * * @covers \eZ\Publish\Core\Repository\ContentService::removeTranslation * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException - * @expectedExceptionMessage User does not have access to 'delete' 'content' + * @expectedExceptionMessage User does not have access to 'remove' 'content' */ public function testRemoveTranslationThrowsUnauthorizedException() { diff --git a/eZ/Publish/Core/Repository/ContentService.php b/eZ/Publish/Core/Repository/ContentService.php index b497daccdbb..5a2256347fe 100644 --- a/eZ/Publish/Core/Repository/ContentService.php +++ b/eZ/Publish/Core/Repository/ContentService.php @@ -1900,10 +1900,10 @@ public function removeTranslation(ContentInfo $contentInfo, $languageCode) $versions = []; foreach ($this->loadVersions($contentInfo) as $versionInfo) { // check if user is authorized to delete Version - if (!$this->repository->canUser('content', 'delete', $versionInfo)) { + if (!$this->repository->canUser('content', 'remove', $versionInfo)) { throw new UnauthorizedException( 'content', - 'delete', + 'remove', [ 'contentId' => $contentInfo->id, 'versionNo' => $versionInfo->versionNo,