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

Core/Base/Exceptions/UnauthorizedException.php
Go to the documentation of this file.
1 <?php
2
7 namespace eZ\Publish\Core\Base\Exceptions;
8
9 use eZ\Publish\API\Repository\Exceptions\UnauthorizedException as APIUnauthorizedException;
10 use Exception;
11 use eZ\Publish\Core\Base\Translatable;
12 use eZ\Publish\Core\Base\TranslatableBase;
13
20 class UnauthorizedException extends APIUnauthorizedException implements Httpable, Translatable
21 {
22 use TranslatableBase;
23
34 public function __construct($module, $function, array $properties = null, Exception $previous = null)
35 {
36 $this->setMessageTemplate("User does not have access to '%function%' '%module%'");
37 $this->setParameters(['%module%' => $module, '%function%' => $function]);
38
39 if ($properties) {
40 $this->setMessageTemplate("User does not have access to '%function%' '%module%' with: %with%");
41 $with = [];
42 foreach ($properties as $name => $value) {
43 $with[] = "{$name} '{$value}'";
44 }
45 $this->addParameter('%with%', implode(', ', $with));
46 }
47
48 parent::__construct($this->getBaseTranslation(), self::UNAUTHORIZED, $previous);
49 }
50 }
eZ\Publish\Core\Base\TranslatableBase
trait TranslatableBase
Trait providing a default implementation of Translatable.
Definition: TranslatableBase.php:13
eZ\Publish\API\Repository\Exceptions\UnauthorizedException
This Exception is thrown if the user has is not allowed to perform a service operation.
Definition: API/Repository/Exceptions/UnauthorizedException.php:15
eZ\Publish\Core\Base\Exceptions\UnauthorizedException
UnauthorizedException Exception implementation.
Definition: Core/Base/Exceptions/UnauthorizedException.php:21
eZ\Publish\Core\Base\Exceptions\UnauthorizedException\__construct
__construct($module, $function, array $properties=null, Exception $previous=null)
Generates: User does not have access to '{$function}' '{$module}'[ with: property....
Definition: Core/Base/Exceptions/UnauthorizedException.php:34
eZ\Publish\Core\Base\Exceptions\Httpable
Interface for exceptions that maps to http status codes.
Definition: Httpable.php:15
eZ\Publish\Core\Base\Translatable
Interface for translatable value objects.
Definition: Core/Base/Translatable.php:13
eZ\Publish\Core\Base\Translatable\setMessageTemplate
setMessageTemplate($messageTemplate)
Injects the message template.
eZ\Publish\Core\Base\Translatable\getBaseTranslation
getBaseTranslation()
Returns base translation, computed with message template and parameters.
eZ\Publish\Core\Base\Translatable\setParameters
setParameters(array $parameters)
Injects the hash map, with param placeholder as key and its corresponding value.
eZ\Publish\Core\Base\Translatable\addParameter
addParameter($name, $value)
Adds a parameter to existing hash map.
eZ\Publish\Core\Base\Exceptions
Definition: Core/Base/Exceptions/BadStateException.php:7
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.