@AuthorizeAction multiple actions

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

@AuthorizeAction multiple actions

nebojsa.nedic
Hello all,

I would like to ask is it possible to add multiple authorize actions on one class.

It would mean that in case the user has role (i.e.) "Admin" component is enabled and rendered, for role "user" component is disabled and rendered, and for role "guest" component is not rendered.

Kind of combination of these two annotations:
@AuthorizeAction(action = "ENABLE", roles = { "ROLE_ADMIN" })
@AuthorizeAction(action = "RENDER", roles = { "ROLE_USER" })

What would be the best way to implement this?

Thank you.
Reply | Threaded
Open this post in threaded view
|

Re: @AuthorizeAction multiple actions

Martin Grigorov-4
On Thu, Oct 27, 2011 at 1:23 PM, nebojsa.nedic
<[hidden email]> wrote:

> Hello all,
>
> I would like to ask is it possible to add multiple authorize actions on one
> class.
>
> It would mean that in case the user has role (i.e.) "Admin" component is
> enabled and rendered, for role "user" component is disabled and rendered,
> and for role "guest" component is not rendered.
>
> Kind of combination of these two annotations:
> @AuthorizeAction(action = "ENABLE", roles = { "ROLE_ADMIN" })
> @AuthorizeAction(action = "RENDER", roles = { "ROLE_USER" })

@AuthorizeAction(action = "ENABLE", roles = { "ROLE_ADMIN", "ROLE_USER" })
@AuthorizeAction(action = "RENDER", roles = { "ROLE_USER" })

List all roles which are authorized to do the action.

>
> What would be the best way to implement this?
>
> Thank you.
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/AuthorizeAction-multiple-actions-tp3943997p3943997.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>



--
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: @AuthorizeAction multiple actions

James Carman-3
In reply to this post by nebojsa.nedic
You can't have two of the same annotations on the same target.  You would
need an @AuthorizeActions which would group them together.  Or, check out
how we handled this in wicketopia (shameless plug).  :-)

Sent from tablet device.  Please excuse typos and brevity.
On Oct 27, 2011 7:23 AM, "nebojsa.nedic" <[hidden email]> wrote:
Reply | Threaded
Open this post in threaded view
|

Re: @AuthorizeAction multiple actions

James Carman
In reply to this post by Martin Grigorov-4
He had different actions
On Oct 27, 2011 7:32 AM, "Martin Grigorov" <[hidden email]> wrote:

> On Thu, Oct 27, 2011 at 1:23 PM, nebojsa.nedic
> <[hidden email]> wrote:
> > Hello all,
> >
> > I would like to ask is it possible to add multiple authorize actions on
> one
> > class.
> >
> > It would mean that in case the user has role (i.e.) "Admin" component is
> > enabled and rendered, for role "user" component is disabled and rendered,
> > and for role "guest" component is not rendered.
> >
> > Kind of combination of these two annotations:
> > @AuthorizeAction(action = "ENABLE", roles = { "ROLE_ADMIN" })
> > @AuthorizeAction(action = "RENDER", roles = { "ROLE_USER" })
>
> @AuthorizeAction(action = "ENABLE", roles = { "ROLE_ADMIN", "ROLE_USER" })
> @AuthorizeAction(action = "RENDER", roles = { "ROLE_USER" })
>
> List all roles which are authorized to do the action.
> >
> > What would be the best way to implement this?
> >
> > Thank you.
> >
> > --
> > View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/AuthorizeAction-multiple-actions-tp3943997p3943997.html
> > Sent from the Users forum mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
> >
>
>
>
> --
> Martin Grigorov
> jWeekend
> Training, Consulting, Development
> http://jWeekend.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: @AuthorizeAction multiple actions

Martijn Dashorst
Administrator
This should work I guess?

http://wicket.apache.org/apidocs/1.5/org/apache/wicket/authroles/authorization/strategies/role/annotations/AuthorizeActions.html

Martijn

On Thu, Oct 27, 2011 at 2:41 PM, James Carman
<[hidden email]> wrote:

> He had different actions
> On Oct 27, 2011 7:32 AM, "Martin Grigorov" <[hidden email]> wrote:
>
>> On Thu, Oct 27, 2011 at 1:23 PM, nebojsa.nedic
>> <[hidden email]> wrote:
>> > Hello all,
>> >
>> > I would like to ask is it possible to add multiple authorize actions on
>> one
>> > class.
>> >
>> > It would mean that in case the user has role (i.e.) "Admin" component is
>> > enabled and rendered, for role "user" component is disabled and rendered,
>> > and for role "guest" component is not rendered.
>> >
>> > Kind of combination of these two annotations:
>> > @AuthorizeAction(action = "ENABLE", roles = { "ROLE_ADMIN" })
>> > @AuthorizeAction(action = "RENDER", roles = { "ROLE_USER" })
>>
>> @AuthorizeAction(action = "ENABLE", roles = { "ROLE_ADMIN", "ROLE_USER" })
>> @AuthorizeAction(action = "RENDER", roles = { "ROLE_USER" })
>>
>> List all roles which are authorized to do the action.
>> >
>> > What would be the best way to implement this?
>> >
>> > Thank you.
>> >
>> > --
>> > View this message in context:
>> http://apache-wicket.1842946.n4.nabble.com/AuthorizeAction-multiple-actions-tp3943997p3943997.html
>> > Sent from the Users forum mailing list archive at Nabble.com.
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [hidden email]
>> > For additional commands, e-mail: [hidden email]
>> >
>> >
>>
>>
>>
>> --
>> Martin Grigorov
>> jWeekend
>> Training, Consulting, Development
>> http://jWeekend.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>



--
Become a Wicket expert, learn from the best: http://wicketinaction.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: @AuthorizeAction multiple actions

James Carman
That's what I said!  :)
On Oct 27, 2011 8:44 AM, "Martijn Dashorst" <[hidden email]>
wrote:

> This should work I guess?
>
>
> http://wicket.apache.org/apidocs/1.5/org/apache/wicket/authroles/authorization/strategies/role/annotations/AuthorizeActions.html
>
> Martijn
>
> On Thu, Oct 27, 2011 at 2:41 PM, James Carman
> <[hidden email]> wrote:
> > He had different actions
> > On Oct 27, 2011 7:32 AM, "Martin Grigorov" <[hidden email]> wrote:
> >
> >> On Thu, Oct 27, 2011 at 1:23 PM, nebojsa.nedic
> >> <[hidden email]> wrote:
> >> > Hello all,
> >> >
> >> > I would like to ask is it possible to add multiple authorize actions
> on
> >> one
> >> > class.
> >> >
> >> > It would mean that in case the user has role (i.e.) "Admin" component
> is
> >> > enabled and rendered, for role "user" component is disabled and
> rendered,
> >> > and for role "guest" component is not rendered.
> >> >
> >> > Kind of combination of these two annotations:
> >> > @AuthorizeAction(action = "ENABLE", roles = { "ROLE_ADMIN" })
> >> > @AuthorizeAction(action = "RENDER", roles = { "ROLE_USER" })
> >>
> >> @AuthorizeAction(action = "ENABLE", roles = { "ROLE_ADMIN", "ROLE_USER"
> })
> >> @AuthorizeAction(action = "RENDER", roles = { "ROLE_USER" })
> >>
> >> List all roles which are authorized to do the action.
> >> >
> >> > What would be the best way to implement this?
> >> >
> >> > Thank you.
> >> >
> >> > --
> >> > View this message in context:
> >>
> http://apache-wicket.1842946.n4.nabble.com/AuthorizeAction-multiple-actions-tp3943997p3943997.html
> >> > Sent from the Users forum mailing list archive at Nabble.com.
> >> >
> >> > ---------------------------------------------------------------------
> >> > To unsubscribe, e-mail: [hidden email]
> >> > For additional commands, e-mail: [hidden email]
> >> >
> >> >
> >>
> >>
> >>
> >> --
> >> Martin Grigorov
> >> jWeekend
> >> Training, Consulting, Development
> >> http://jWeekend.com
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [hidden email]
> >> For additional commands, e-mail: [hidden email]
> >>
> >>
> >
>
>
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: @AuthorizeAction multiple actions

nebojsa.nedic
Thank you very much for your help.

Yes that helped - I did not know for this annotation.

This is the code how it looks like now:
@AuthorizeActions(actions = {
                @AuthorizeAction(action = "ENABLE", roles = { "ROLE_ADMIN" }),
                @AuthorizeAction(action = "RENDER", roles = { "ROLE_ADMIN", "ROLE_USER" })
})

At first, I even didn't saw this "s" at the end :).