You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Jonas <ba...@gmail.com> on 2007/10/16 15:10:58 UTC

IAuthorizationStrategy and DropDownChoice

While implementing a custom IAuthorizationStrategy for our web app,
I noticed that DropDownChoice (and any other AbstractChoice) doesn't
honor restrictions on Component.RENDER and Component.ENABLE.

Is there a recommended way to make that work?
Wouldn't it make sense that AbstractChoice did honor those restrictions,
as e.g. AbstractLink does?
That would probably require an extension of the IAuthorizationStrategy
interface, since the selectable options are just any kind of objects,
not wicket components. Maybe a method like
boolean isActionAuthorized(Component component, Object item, Action action);
would do the trick?


Jonas

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


Re: IAuthorizationStrategy and DropDownChoice

Posted by Igor Vaynberg <ig...@gmail.com>.
On 10/17/07, Maeder Thomas <th...@ecofin.ch> wrote:
> 1) why is option enablement not forwarded to the authorization strategy?

because individual options in a dropdownchoice are not components

> 2) Is there a "blessed" way to no render options depending on
> authorization.

no, you need to come up with your own

-igor

>
> Of course you can hack it, but you'll end up with your authorization
> code sprinkled around your project instead of a single point.
>
> Thomas
>
> > -----Original Message-----
> > From: Maurice Marrink [mailto:marrink@gmail.com]
> > Sent: Mittwoch, 17. Oktober 2007 09:07
> > To: users@wicket.apache.org
> > Subject: Re: IAuthorizationStrategy and DropDownChoice
> >
> > Did you notice this method in AbstractChoice?
> > protected boolean isDisabled(final Object object, int index,
> > String selected)
> >
> > It is designed to do exactly what you want. In Wicket 1.3
> > only, in wicket 1.2 you need to override protected void
> > appendOptionHtml(AppendingStringBuffer buffer, Object choice,
> > int index, String selected) and do it yourself.
> >
> > Maurice
> >
> > On 10/16/07, Jonas <ba...@gmail.com> wrote:
> > > While implementing a custom IAuthorizationStrategy for our
> > web app, I
> > > noticed that DropDownChoice (and any other AbstractChoice) doesn't
> > > honor restrictions on Component.RENDER and Component.ENABLE.
> > >
> > > Is there a recommended way to make that work?
> > > Wouldn't it make sense that AbstractChoice did honor those
> > > restrictions, as e.g. AbstractLink does?
> > > That would probably require an extension of the
> > IAuthorizationStrategy
> > > interface, since the selectable options are just any kind
> > of objects,
> > > not wicket components. Maybe a method like boolean
> > > isActionAuthorized(Component component, Object item, Action
> > action);
> > > would do the trick?
> > >
> > >
> > > Jonas
> > >
> > >
> > ---------------------------------------------------------------------
> > > 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
> >
> >
>
> ---------------------------------------------------------------------
> 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: IAuthorizationStrategy and DropDownChoice

Posted by Maeder Thomas <th...@ecofin.ch>.
I don't think that is what he's getting at, I guess the real questions
are:

1) why is option enablement not forwarded to the authorization strategy?
2) Is there a "blessed" way to no render options depending on
authorization.

Of course you can hack it, but you'll end up with your authorization
code sprinkled around your project instead of a single point.

Thomas 

> -----Original Message-----
> From: Maurice Marrink [mailto:marrink@gmail.com] 
> Sent: Mittwoch, 17. Oktober 2007 09:07
> To: users@wicket.apache.org
> Subject: Re: IAuthorizationStrategy and DropDownChoice
> 
> Did you notice this method in AbstractChoice?
> protected boolean isDisabled(final Object object, int index, 
> String selected)
> 
> It is designed to do exactly what you want. In Wicket 1.3 
> only, in wicket 1.2 you need to override protected void 
> appendOptionHtml(AppendingStringBuffer buffer, Object choice, 
> int index, String selected) and do it yourself.
> 
> Maurice
> 
> On 10/16/07, Jonas <ba...@gmail.com> wrote:
> > While implementing a custom IAuthorizationStrategy for our 
> web app, I 
> > noticed that DropDownChoice (and any other AbstractChoice) doesn't 
> > honor restrictions on Component.RENDER and Component.ENABLE.
> >
> > Is there a recommended way to make that work?
> > Wouldn't it make sense that AbstractChoice did honor those 
> > restrictions, as e.g. AbstractLink does?
> > That would probably require an extension of the 
> IAuthorizationStrategy 
> > interface, since the selectable options are just any kind 
> of objects, 
> > not wicket components. Maybe a method like boolean 
> > isActionAuthorized(Component component, Object item, Action 
> action); 
> > would do the trick?
> >
> >
> > Jonas
> >
> > 
> ---------------------------------------------------------------------
> > 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
> 
> 

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


Re: IAuthorizationStrategy and DropDownChoice

Posted by Maurice Marrink <ma...@gmail.com>.
Did you notice this method in AbstractChoice?
protected boolean isDisabled(final Object object, int index, String selected)

It is designed to do exactly what you want. In Wicket 1.3 only, in
wicket 1.2 you need to override protected void
appendOptionHtml(AppendingStringBuffer buffer, Object choice, int
index, String selected) and do it yourself.

Maurice

On 10/16/07, Jonas <ba...@gmail.com> wrote:
> While implementing a custom IAuthorizationStrategy for our web app,
> I noticed that DropDownChoice (and any other AbstractChoice) doesn't
> honor restrictions on Component.RENDER and Component.ENABLE.
>
> Is there a recommended way to make that work?
> Wouldn't it make sense that AbstractChoice did honor those restrictions,
> as e.g. AbstractLink does?
> That would probably require an extension of the IAuthorizationStrategy
> interface, since the selectable options are just any kind of objects,
> not wicket components. Maybe a method like
> boolean isActionAuthorized(Component component, Object item, Action action);
> would do the trick?
>
>
> Jonas
>
> ---------------------------------------------------------------------
> 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