Exponential 5.x Kernel 7.5.40 Exponential New Stack (Symfony-based) Kernel — PHP Class Reference

ContentDeleteEvaluator.php
Go to the documentation of this file.
1 <?php
2
7 declare(strict_types=1);
8
9 namespace eZ\Publish\Core\Limitation\LanguageLimitation;
10
11 use eZ\Publish\API\Repository\Values\User\Limitation;
12 use eZ\Publish\Core\Limitation\LanguageLimitationType;
13 use eZ\Publish\SPI\Limitation\Target;
14
18 final class ContentDeleteEvaluator implements VersionTargetEvaluator
19 {
20 public function accept(Target\Version $targetVersion): bool
21 {
22 return !empty($targetVersion->getTranslationsToDelete());
23 }
24
28 public function evaluate(Target\Version $targetVersion, Limitation $limitationValue): ?bool
29 {
30 $diff = array_diff(
31 $targetVersion->getTranslationsToDelete(),
32 $limitationValue->limitationValues
33 );
34 $accessVote = empty($diff)
35 ? LanguageLimitationType::ACCESS_GRANTED
36 : LanguageLimitationType::ACCESS_DENIED;
37
38 return $accessVote;
39 }
40 }
eZ\Publish\API\Repository\Values\User\Limitation
This class represents a Limitation applied to a policy.
Definition: API/Repository/Values/User/Limitation.php:15
eZ\Publish\Core\Limitation\LanguageLimitationType
LanguageLimitation is a Content limitation.
Definition: LanguageLimitationType.php:35
eZ\Publish\Core\Limitation\LanguageLimitation\ContentDeleteEvaluator
Definition: ContentDeleteEvaluator.php:19
eZ\Publish\Core\Limitation\LanguageLimitation\ContentDeleteEvaluator\accept
accept(Target\Version $targetVersion)
Definition: ContentDeleteEvaluator.php:20
eZ\Publish\Core\Limitation\LanguageLimitation\ContentDeleteEvaluator\evaluate
evaluate(Target\Version $targetVersion, Limitation $limitationValue)
Allow access if all of the given language codes for content matches limitation values.
Definition: ContentDeleteEvaluator.php:28
eZ\Publish\SPI\Limitation\Target\Version
Definition: SPI/Limitation/Target/Version.php:25
eZ\Publish\Core\Limitation\LanguageLimitation\VersionTargetEvaluator
Definition: VersionTargetEvaluator.php:18
eZ\Publish\SPI\Limitation\Target
Marker interface for PermissionResolver::canUser $targets objects.
Definition: SPI/Limitation/Target.php:19
eZ\Publish\SPI\Limitation\Type\ACCESS_GRANTED
const ACCESS_GRANTED
Constants for return value of {.
Definition: SPI/Limitation/Type.php:33
eZ\Publish\SPI\Limitation\Type\ACCESS_DENIED
const ACCESS_DENIED
Definition: SPI/Limitation/Type.php:35
eZ\Publish\API\Repository\Values\User\Limitation
Definition: BlockingLimitation.php:7
eZ\Publish\Core\Limitation\LanguageLimitation
Definition: ContentDeleteEvaluator.php:9
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.