vhs
vhs copied to clipboard
v:security / AbstractSecurityViewHelper does not work due to wrong type / ObjectStorage registration
Currently the arguments are registered like this (example for frontendUserGroups argument, but true for all ObjectStorage in this ViewHelper):
$this->registerArgument(
'frontendUserGroups',
'<TYPO3\CMS\Extbase\Persistence\ObjectStorage>\TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup',
'The FrontendUserGroups ObjectStorage to allow/deny'
);
But it's not possible to have a model that returns <TYPO3\CMS\Extbase\Persistence\ObjectStorage>\TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup
- a PHP model can only return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
.
We can not use this ViewHelper in our projects because of this. This directly creates exceptions due to wrong types.
We are using PHP 7.1, TYPO3 8 and vhs 5.
Any news on this?
Just to be clear, I'm talking about this: https://github.com/FluidTYPO3/vhs/blob/development/Classes/ViewHelpers/Security/AbstractSecurityViewHelper.php#L71 https://github.com/FluidTYPO3/vhs/blob/development/Classes/ViewHelpers/Security/AbstractSecurityViewHelper.php#L81
Any news here?
Just for the record: our hotfix is an XClass:
class AllowViewHelper extends \FluidTYPO3\Vhs\ViewHelpers\Security\AllowViewHelper
{
public function initializeArguments(): void
{
parent::initializeArguments();
$this->overrideArgument(
'frontendUserGroups',
\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class,
'The FrontendUserGroups ObjectStorage to allow/deny'
);
}
}
Hello?
Hi @foobar13372,
We would appreciate a pull request to change the type of this argument to something more generic, such as iterable
(it doesn't necessarily have to be an ObjectStorage). The issue has semi-low priority because a workaround is provided and the ViewHelpers in this scope are rarely used - if you're able to prepare the pull request that will speed things up ;)
Cheers, Claus