[TYPO3-mvc] Access control (very simple) example

Nathan Lenz typo3 at k9tfk.com
Thu Jan 7 23:22:05 CET 2010


Franz Koch wrote:
> Hi,
> 
>> I have a part of a fluid template that I only want to show to people who
>> are logged in and in a special group.
>>
>> Is there a way to do that within the condition of an<f:if>  tag?  I
>> tried various versions but couldn't get it to work.
> 
> sure - you have multiple options to do this:
> a) provide a basic ACLviewHelper that fills your needs
> b) do the ACL checks in your controller and assign a special variable to
> the view you can check for lateron. eg:
> 
Thanks Franz,

I created a view helper (copied the "f:if" helper from fluid).

Tx_Myext_ViewHelpers_IfAccessViewHelper

Changed the render() method to do the appropriate logic and changed the
input parameter from $condition to $groupUid.

Then added this to my fluid template:

<myext:ifAccess groupUid="{settings.mySpecialGroupUid}">
	Show something special
</myext:ifAccess>

However, it never executes,... the tags are displaed there as is.

If I copy the exact same class and put it in fluid, rename it to:

Tx_Fluid_ViewHelpers_IfAccessViewHelper

It works as expected.

Do I need to do anything special to "register" my view helper?

--Nathan


More information about the TYPO3-project-typo3v4mvc mailing list