You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Michael Echerer <me...@tngtech.com> on 2004/03/30 13:42:56 UTC

Design suggestion for right-specific component rendering

Hi all,

after reading Tapestry in Action Chapters 9 & 10, i wonder if something similar
to the PageValidateListener interface for pages exists for components.

Problem:

For an Tapestry application prototype I primarly don't need to block pages for
unlogged users. 

Instead I have to render components only if current user rights allow this
specific component for an user group. 
Moreover it may be possible that a component contains other components meaning
that a top level components should only render if the user has rights to see any
of the enclosed sub-components.

Background: Certain application features (thus components) should only be
available for certain user groups.

Since there seems to be no ComponentValidateLister I would appreciate any design
suggestions where to plug such a component specific rights check into the
Tapestry framework.
Until now I presume that I need some kind of BaseComponent subclass probably
overriding the renderComponent() method that either calls
super.renderComponent() or skips doing so based on the right validition. 
But I'm not sure if this might be already too late because of parameter reading
and other Tapestry under-the-hood activities etc.

Hope you can give my hints before I start implementing a major design flaw. ;-)

Thx
Michael

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: Design suggestion for right-specific component rendering

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
One option is to create "wrapper" components that surround things with 
an @contrib:FormConditional with the right logic to check roles.

I think it would be a big change to inject that type of behavior around 
all the components that you might use, though.  Even creating these 
types of wrappers might be a lot of work - depending on what you need 
to wrap.

I'm definitely curious what others have done for this type of scenario.

	Erik


On Mar 30, 2004, at 6:42 AM, Michael Echerer wrote:

> Hi all,
>
> after reading Tapestry in Action Chapters 9 & 10, i wonder if 
> something similar
> to the PageValidateListener interface for pages exists for components.
>
> Problem:
>
> For an Tapestry application prototype I primarly don't need to block 
> pages for
> unlogged users.
>
> Instead I have to render components only if current user rights allow 
> this
> specific component for an user group.
> Moreover it may be possible that a component contains other components 
> meaning
> that a top level components should only render if the user has rights 
> to see any
> of the enclosed sub-components.
>
> Background: Certain application features (thus components) should only 
> be
> available for certain user groups.
>
> Since there seems to be no ComponentValidateLister I would appreciate 
> any design
> suggestions where to plug such a component specific rights check into 
> the
> Tapestry framework.
> Until now I presume that I need some kind of BaseComponent subclass 
> probably
> overriding the renderComponent() method that either calls
> super.renderComponent() or skips doing so based on the right 
> validition.
> But I'm not sure if this might be already too late because of 
> parameter reading
> and other Tapestry under-the-hood activities etc.
>
> Hope you can give my hints before I start implementing a major design 
> flaw. ;-)
>
> Thx
> Michael
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org