FormDefinitionValidationService implements SingletonInterface
Table of Contents
Interfaces
- SingletonInterface
- "empty" interface for singletons (marker interface pattern)
Methods
- isPropertyValueEqualToHistoricalValue() : bool
- Returns TRUE if a property value is equals to the historical value and FALSE if not.
- validateFormDefinitionProperties() : void
- Validate the form definition properties using the form setup.
- checkHmacDataIntegrity() : mixed
- Compares the historical value and the hmac hash to ensure the integrity of the data.
- validateAllFormElementPropertyValuesByHmac() : void
- Walk through all form element properties and checks if the values matches to their hmac hashes.
- validateAllPropertyCollectionElementValuesByHmac() : void
- Walk through all property collection properties and checks if the values matches to their hmac hashes.
- validateAllPropertyValuesFromCreatableFormElement() : void
- Walk through all form element properties and checks if the property is defined within the form editor setup or if the property is defined within the "predefinedDefaults" in the form editor setup and the property value matches the predefined value or if there is a valid hmac hash for the value.
- validateAllPropertyValuesFromCreatablePropertyCollectionElement() : void
- Walk through all property collection properties and checks if the property is defined within the form editor setup or if the property is defined within the "predefinedDefaults" in the form editor setup and the property value matches the predefined value or if there is a valid hmac hash for the value.
Methods
isPropertyValueEqualToHistoricalValue()
Returns TRUE if a property value is equals to the historical value and FALSE if not.
public
isPropertyValueEqualToHistoricalValue(array<string|int, mixed> $hmacContent, mixed $propertyValue, array<string|int, mixed> $hmacData, string $sessionToken) : bool
"Historical values" means values which are available within the form definition while the form editor is loaded and the values which are available after a successful validation of the form definition on a save operation. The value must be equal to the historical value if the property key for the value is not defined within the form setup. This means that the property can not be changed by the form editor but we want to keep the value in its original state. If this is not the case (return value is FALSE), an exception must be thrown.
Parameters
- $hmacContent : array<string|int, mixed>
- $propertyValue : mixed
- $hmacData : array<string|int, mixed>
- $sessionToken : string
Tags
Return values
boolvalidateFormDefinitionProperties()
Validate the form definition properties using the form setup.
public
validateFormDefinitionProperties(array<string|int, mixed> $currentFormElement, string $prototypeName, string $sessionToken) : void
Pseudo workflow: Is the form element type creatable by the form editor? YES foreach(form element properties) (without finishers|validators) is the form element property defined in the form setup (can be manipulated)? YES is the form element property configured to only allow a limited set of values (e.g. Inspector-MultiSelectEditor, Inspector-SingleSelectEditor ...) YES is the form element property value within the set of allowed values? YES valid! NO invalid! throw exception NO valid! NO is the form element property defined in "predefinedDefaults" in the form setup (cannot be manipulated but should be written)? YES is the form element property value equals to the value defined in "predefinedDefaults" in the form setup? YES valid! NO invalid! throw exception NO is there a hmac hash available for the form element property value (cannot be manipulated but should be written)? YES is the form element property value equals the historical value (and is the historical value valid)? YES valid! NO invalid! throw exception NO invalid! throw exception foreach(form elements finishers|validators) is the form elements finisher|validator creatable by the form editor? YES foreach(form elements finisher|validator properties) is the form elements finisher|validator property defined in the form setup (can be manipulated)? YES is the form elements finisher|validator property configured to only allow a limited set of values (e.g. Inspector-MultiSelectEditor, Inspector-SingleSelectEditor ...) YES is the form elements finisher|validator property value within the set of allowed values? YES valid! NO invalid! throw exception NO valid! NO is the form elements finisher|validator property defined in "predefinedDefaults" in the form setup (cannot be manipulated but should be written)? YES is the form elements finisher|validator property value equals to the value defined in "predefinedDefaults" in the form setup? YES valid! NO invalid! throw exception NO is there a hmac hash available for the form elements finisher|validator property value (can not be manipulated but should be written)? YES is the form elements finisher|validator property value equals the historical value (and is the historical value valid)? YES valid! NO invalid! throw exception NO invalid! throw exception NO foreach(form elements finisher|validator properties) is there a hmac hash available for the form elements finisher|validator property value (can not be manipulated but should be written)? YES is the form elements finisher|validator property value equals the historical value (and is the historical value valid)? YES valid! NO invalid! throw exception NO invalid! throw exception NO foreach(form element properties) (without finishers|validators) is there a hmac hash available for the form element property value (cannot be manipulated but should be written)? YES is the form element property value equals the historical value (and is the historical value valid)? YES valid! NO invalid! throw exception NO invalid! throw exception foreach(form elements finisher|validator properties) is there a hmac hash available for the form elements finisher|validator property value (can not be manipulated but should be written)? YES is the form elements finisher|validator property value equals the historical value (and is the historical value valid)? YES valid! NO invalid! throw exception NO invalid! throw exception
Parameters
- $currentFormElement : array<string|int, mixed>
- $prototypeName : string
- $sessionToken : string
Tags
checkHmacDataIntegrity()
Compares the historical value and the hmac hash to ensure the integrity of the data.
protected
checkHmacDataIntegrity(array<string|int, mixed> $hmacData, array<string|int, mixed> $hmacContent, string $sessionToken) : mixed
An exception will be thrown if the value is modified.
Parameters
- $hmacData : array<string|int, mixed>
- $hmacContent : array<string|int, mixed>
- $sessionToken : string
Tags
validateAllFormElementPropertyValuesByHmac()
Walk through all form element properties and checks if the values matches to their hmac hashes.
protected
validateAllFormElementPropertyValuesByHmac(array<string|int, mixed> $currentElement, string $sessionToken, ValidationDto $validationDto) : void
Parameters
- $currentElement : array<string|int, mixed>
- $sessionToken : string
- $validationDto : ValidationDto
validateAllPropertyCollectionElementValuesByHmac()
Walk through all property collection properties and checks if the values matches to their hmac hashes.
protected
validateAllPropertyCollectionElementValuesByHmac(array<string|int, mixed> $currentElement, string $sessionToken, ValidationDto $validationDto) : void
Parameters
- $currentElement : array<string|int, mixed>
- $sessionToken : string
- $validationDto : ValidationDto
validateAllPropertyValuesFromCreatableFormElement()
Walk through all form element properties and checks if the property is defined within the form editor setup or if the property is defined within the "predefinedDefaults" in the form editor setup and the property value matches the predefined value or if there is a valid hmac hash for the value.
protected
validateAllPropertyValuesFromCreatableFormElement(array<string|int, mixed> $currentElement, string $sessionToken, ValidationDto $validationDto) : void
Parameters
- $currentElement : array<string|int, mixed>
- $sessionToken : string
- $validationDto : ValidationDto
validateAllPropertyValuesFromCreatablePropertyCollectionElement()
Walk through all property collection properties and checks if the property is defined within the form editor setup or if the property is defined within the "predefinedDefaults" in the form editor setup and the property value matches the predefined value or if there is a valid hmac hash for the value.
protected
validateAllPropertyValuesFromCreatablePropertyCollectionElement(array<string|int, mixed> $currentElement, string $sessionToken, ValidationDto $validationDto) : void
Parameters
- $currentElement : array<string|int, mixed>
- $sessionToken : string
- $validationDto : ValidationDto