vhs icon indicating copy to clipboard operation
vhs copied to clipboard

v:security / AbstractSecurityViewHelper does not work due to wrong type / ObjectStorage registration

Open foobar13372 opened this issue 5 years ago • 4 comments

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.

foobar13372 avatar Aug 10 '18 08:08 foobar13372

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

foobar13372 avatar Nov 27 '18 07:11 foobar13372

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'
        );
    }
}

foobar13372 avatar Mar 14 '19 12:03 foobar13372

Hello?

foobar13372 avatar Aug 21 '19 06:08 foobar13372

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

NamelessCoder avatar Aug 22 '19 07:08 NamelessCoder