TYPO3CMS
9.5
Main Page
Related Pages
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Variables
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
Files
File List
File Members
All
$
d
e
r
u
Functions
Variables
$
e
r
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Pages
CollectionBasedValidator.php
Go to the documentation of this file.
1
<?php
2
declare(strict_types = 1);
3
namespace
TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Validators
;
4
5
/*
6
* This file is part of the TYPO3 CMS project.
7
*
8
* It is free software; you can redistribute it and/or modify it under
9
* the terms of the GNU General Public License, either version 2
10
* of the License, or any later version.
11
*
12
* For the full copyright and license information, please read the
13
* LICENSE.txt file that was distributed with this source code.
14
*
15
* The TYPO3 project - inspiring people to share!
16
*/
17
18
use
TYPO3\CMS\Core\Utility\ArrayUtility
;
19
use
TYPO3\CMS\Form\Domain\Configuration\Exception\PropertyException
;
20
24
abstract
class
CollectionBasedValidator
extends
AbstractValidator
25
{
26
38
public
function
validatePropertyCollectionElementPropertyValueByHmacData
(
39
array
$currentElement
,
40
$value,
41
string
$sessionToken
,
42
ValidationDto
$dto
43
): void {
44
$hmacDataPath = $this->
buildHmacDataPath
($dto->
getPropertyPath
());
45
if
(
ArrayUtility::isValidPath
(
$currentElement
, $hmacDataPath,
'.'
)) {
46
$hmacData =
ArrayUtility::getValueByPath
(
$currentElement
, $hmacDataPath,
'.'
);
47
48
$hmacContent = [
49
$dto->
getFormElementIdentifier
(),
50
$dto->
getPropertyCollectionName
(),
51
$dto->
getPropertyCollectionElementIdentifier
(),
52
$dto->
getPropertyPath
()
53
];
54
55
if
(!$this->
getFormDefinitionValidationService
()->isPropertyValueEqualToHistoricalValue($hmacContent, $value, $hmacData,
$sessionToken
)) {
56
$message =
'The value "%s" of property "%s" (form element "%s" / "%s.%s") is not equal to the historical value "%s" #1528591586'
;
57
throw
new
PropertyException
(
58
sprintf(
59
$message,
60
$value,
61
$dto->
getPropertyPath
(),
62
$dto->
getFormElementIdentifier
(),
63
$dto->
getPropertyCollectionName
(),
64
$dto->
getPropertyCollectionElementIdentifier
(),
65
$hmacData[
'value'
] ??
''
66
),
67
1528591586
68
);
69
}
70
}
else
{
71
$message =
'No hmac found for property "%s" (form element "%s" / "%s.%s") #1528591585'
;
72
throw
new
PropertyException
(
73
sprintf(
74
$message,
75
$dto->
getPropertyPath
(),
76
$dto->
getFormElementIdentifier
(),
77
$dto->
getPropertyCollectionName
(),
78
$dto->
getPropertyCollectionElementIdentifier
()
79
),
80
1528591585
81
);
82
}
83
}
84
}
TYPO3\CMS\Extbase\Property\Exception
Definition:
DuplicateObjectException.php:2
TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Validators\AbstractValidator\$sessionToken
string $sessionToken
Definition:
AbstractValidator.php:39
TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Validators\AbstractValidator\$currentElement
array $currentElement
Definition:
AbstractValidator.php:35
TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Validators\ValidationDto
Definition:
ValidationDto.php:23
TYPO3\CMS\Core\Utility\ArrayUtility\isValidPath
static bool isValidPath(array $array, $path, $delimiter='/')
Definition:
ArrayUtility.php:143
TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Validators\AbstractValidator\buildHmacDataPath
string buildHmacDataPath(string $propertyPath)
Definition:
AbstractValidator.php:63
TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Validators\ValidationDto\getPropertyPath
string getPropertyPath()
Definition:
ValidationDto.php:100
TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Validators\ValidationDto\getFormElementIdentifier
string getFormElementIdentifier()
Definition:
ValidationDto.php:92
TYPO3\CMS\Core\Utility\ArrayUtility\getValueByPath
static mixed getValueByPath(array $array, $path, $delimiter='/')
Definition:
ArrayUtility.php:179
TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Validators\AbstractValidator\getFormDefinitionValidationService
FormDefinitionValidationService getFormDefinitionValidationService()
Definition:
AbstractValidator.php:75
TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Validators\CollectionBasedValidator
Definition:
CollectionBasedValidator.php:25
TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Validators\ValidationDto\getPropertyCollectionElementIdentifier
string getPropertyCollectionElementIdentifier()
Definition:
ValidationDto.php:116
TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Validators\CollectionBasedValidator\validatePropertyCollectionElementPropertyValueByHmacData
validatePropertyCollectionElementPropertyValueByHmacData(array $currentElement, $value, string $sessionToken, ValidationDto $dto)
Definition:
CollectionBasedValidator.php:38
TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Validators
Definition:
AbstractValidator.php:3
TYPO3\CMS\Core\Utility\ArrayUtility
Definition:
ArrayUtility.php:23
TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Validators\AbstractValidator
Definition:
AbstractValidator.php:27
TYPO3\CMS\Form\Domain\Configuration\Exception\PropertyException
Definition:
PropertyException.php:24
TYPO3\CMS\Form\Domain\Configuration\FormDefinition\Validators\ValidationDto\getPropertyCollectionName
string getPropertyCollectionName()
Definition:
ValidationDto.php:108
doxygen
typo3
sysext
form
Classes
Domain
Configuration
FormDefinition
Validators
CollectionBasedValidator.php
Generated on Tue Oct 5 2021 01:57:39 for TYPO3CMS by
1.8.18