我想在AllowViewHelper中设置frontendUserGroup参数,但是我不知道该怎么做。
有时(即使我刷新缓存也不确定)会弹出此错误:
参数“ frontendUserGroup”已注册为类型“ TYPO3 \ CMS \ Extbase \ Domain \ Model \ FrontendUserGroup”,但在视图帮助程序“ FluidTYPO3 \ Vhs \ ViewHelpers \ Security \ AllowViewHelper”中的类型为“ string”
仅将用户组的引用作为参数传递如下是否正确?
{namespace v=FluidTYPO3\Vhs\ViewHelpers}
...
<v:security.allow frontendUserGroup="3">
<f:then>
<span>Access granted</span>
</f:then>
<f:else>
<span>Access denied</span>
</f:else>
</v:security.allow>
该参数由ViewHelper进行注册,如下所示:
$this->registerArgument('frontendUserGroup', 'TYPO3\CMS\Extbase\Domain\Model\FrontendUserGroup', 'The FrontendUserGroup to allow/deny');
根据您的示例,您可以仅使用CMS Fluid随附的security.hasRole ViewHelper:
<f:security.ifHasRole role="3">
<f:then>
<span>Access granted</span>
</f:then>
<f:else>
<span>Access denied</span>
</f:else>
</f:security.ifHasRole>
与EXT:vhs中的allow ViewHelper相反,此ViewHelper接受用户组的UID作为参数。除了UID,您还可以传递用户组的标题,但据我所知这可能是模棱两可的。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句