You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Juan Gabriel Arias <ju...@gmail.com> on 2007/10/01 21:27:22 UTC

hide/show components - role based

Hi all,

im working with Wicket 1.2.4, Spring and Acegi.

Im trying to dinamically show or hide html components, like links, buttons,
etc.
Is there a best practice in wicket?

Im also using wicket-auth-roles, and i've been digging a little, but i
couldn't  find a way to do this.

BTW, i already read
http://cwiki.apache.org/WICKET/acegi-and-wicket-auth-roles.html
And in the "Hinding Components" there is a big and nice TODO ;-)


Thanks in advance!
Juan Arias

Re: hide/show components - role based

Posted by Eelco Hillenius <ee...@gmail.com>.
On 10/2/07, Juan Gabriel Arias <ju...@gmail.com> wrote:
> The second one.
> Components should check some roles and enable or disable itself.

Just look closely at how wicket-auth is implemented. It is basically
an example project to show how you can do this stuff yourself.

Note that there is typically a difference between whether something is
visible and whether it is enabled and whether instantiation is
allowed. You need to focus on
IAuthorizationStrategy#isActionAuthorized (Action#RENDER and
Action#ENABLED).

Eelco

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: hide/show components - role based

Posted by ChuckDeal <cd...@csc.com>.

Juan Gabriel Arias wrote:
> 
> The second one.
> Components should check some roles and enable or disable itself.
> 
> Thanks for the answers!
> Juan
> 
> On 10/2/07, Eelco Hillenius <ee...@gmail.com> wrote:
>>
>> On 10/1/07, Kent Tong <ke...@cpttm.org.mo> wrote:
>> >
>> >
>> > Juan Gabriel Arias wrote:
>> > >
>> > > Im trying to dinamically show or hide html components, like links,
>> > > buttons,
>> > > etc.
>> > >
>>
>> What do you mean by 'dynamic'? Do you want to change authorization
>> info for the components dynamically, or do you mean dynamic in that
>> components should figure out what to do at runtime?
>>
>> Eelco
> 

See this thread for a description of how I do context (or data) sensitive
roles. 
http://www.nabble.com/Best-Practices-for-accessing-repainting-sibling-cousin-components--tf3841514.html#a10895313

Chuck

-- 
View this message in context: http://www.nabble.com/hide-show-components---role-based-tf4550513.html#a13005139
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: hide/show components - role based

Posted by Juan Gabriel Arias <ju...@gmail.com>.
The second one.
Components should check some roles and enable or disable itself.

Thanks for the answers!
Juan

On 10/2/07, Eelco Hillenius <ee...@gmail.com> wrote:
>
> On 10/1/07, Kent Tong <ke...@cpttm.org.mo> wrote:
> >
> >
> > Juan Gabriel Arias wrote:
> > >
> > > Im trying to dinamically show or hide html components, like links,
> > > buttons,
> > > etc.
> > >
>
> What do you mean by 'dynamic'? Do you want to change authorization
> info for the components dynamically, or do you mean dynamic in that
> components should figure out what to do at runtime?
>
> Eelco
>
>
>
> > something like:
> >
> > public class MyPage {
> >   public MyPage() {
> >      Link myLink = ...;
> >      MetaDataRoleAuthorizationStrategy.authorize(myLink, RENDER,
> > "role1,role2");
> >   }
> > }
> >
> > --
> > View this message in context:
> http://www.nabble.com/hide-show-components---role-based-tf4550513.html#a12991489
> > Sent from the Wicket - User mailing list archive at Nabble.com.
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: hide/show components - role based

Posted by Eelco Hillenius <ee...@gmail.com>.
On 10/1/07, Kent Tong <ke...@cpttm.org.mo> wrote:
>
>
> Juan Gabriel Arias wrote:
> >
> > Im trying to dinamically show or hide html components, like links,
> > buttons,
> > etc.
> >

What do you mean by 'dynamic'? Do you want to change authorization
info for the components dynamically, or do you mean dynamic in that
components should figure out what to do at runtime?

Eelco



> something like:
>
> public class MyPage {
>   public MyPage() {
>      Link myLink = ...;
>      MetaDataRoleAuthorizationStrategy.authorize(myLink, RENDER,
> "role1,role2");
>   }
> }
>
> --
> View this message in context: http://www.nabble.com/hide-show-components---role-based-tf4550513.html#a12991489
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: hide/show components - role based

Posted by Kent Tong <ke...@cpttm.org.mo>.

Juan Gabriel Arias wrote:
> 
> Im trying to dinamically show or hide html components, like links,
> buttons,
> etc.
> 

something like:

public class MyPage {
  public MyPage() {
     Link myLink = ...;
     MetaDataRoleAuthorizationStrategy.authorize(myLink, RENDER,
"role1,role2");
  }
}

-- 
View this message in context: http://www.nabble.com/hide-show-components---role-based-tf4550513.html#a12991489
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org