You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by Felipe Carvalho <fe...@gmail.com> on 2012/07/30 23:12:23 UTC

Validation of multiple permissions using @RequiresPermissions

Hello,
  I've been using @RequiresPermissions to check a single permission at a
time, e.g.: @RequiresPermissions({"window:open"}).
  The problem is I need is to allow the same method to be executed by
people with distinct permissions,
e.g.: @RequiresPermissions({"window:open", "door:close"}).
  By reading the docs and looking at source code, I understood the list of
strings passed as a parameter to @RequiresPermissions builds up an "AND"
logical expression. Is there a way to build a "OR" logical expression? Is
there some kind of @RequiresAnyPermissions ?

Thanks!

Re: Validation of multiple permissions using @RequiresPermissions

Posted by Felipe Carvalho <fe...@gmail.com>.
Thanks a lot!

On Mon, Jul 30, 2012 at 6:30 PM, Kalle Korhonen
<ka...@gmail.com>wrote:

> @RequiresPermissions(value = { "window:open", "door:close" }, logical
> = Logical.OR)
>
> Kalle
>
>
> On Mon, Jul 30, 2012 at 2:25 PM, Felipe Carvalho
> <fe...@gmail.com> wrote:
> > BTW, I found out https://issues.apache.org/jira/browse/SHIRO-175 relates
> > exactly to what I need, but I can't find the
> > @RequiresAnyPermissions(String[] )  anywhere on the 1.1 or 1.2
> distribution,
> > though.
> >
> > Does anyone know where can I find this annotation?
> >
> > Thanks!
> >
> > On Mon, Jul 30, 2012 at 6:12 PM, Felipe Carvalho <
> felipe.carvalho@gmail.com>
> > wrote:
> >>
> >> Hello,
> >>   I've been using @RequiresPermissions to check a single permission at a
> >> time, e.g.: @RequiresPermissions({"window:open"}).
> >>   The problem is I need is to allow the same method to be executed by
> >> people with distinct permissions, e.g.:
> @RequiresPermissions({"window:open",
> >> "door:close"}).
> >>   By reading the docs and looking at source code, I understood the list
> of
> >> strings passed as a parameter to @RequiresPermissions builds up an "AND"
> >> logical expression. Is there a way to build a "OR" logical expression?
> Is
> >> there some kind of @RequiresAnyPermissions ?
> >>
> >> Thanks!
> >
> >
>

Re: Validation of multiple permissions using @RequiresPermissions

Posted by Kalle Korhonen <ka...@gmail.com>.
@RequiresPermissions(value = { "window:open", "door:close" }, logical
= Logical.OR)

Kalle


On Mon, Jul 30, 2012 at 2:25 PM, Felipe Carvalho
<fe...@gmail.com> wrote:
> BTW, I found out https://issues.apache.org/jira/browse/SHIRO-175 relates
> exactly to what I need, but I can't find the
> @RequiresAnyPermissions(String[] )  anywhere on the 1.1 or 1.2 distribution,
> though.
>
> Does anyone know where can I find this annotation?
>
> Thanks!
>
> On Mon, Jul 30, 2012 at 6:12 PM, Felipe Carvalho <fe...@gmail.com>
> wrote:
>>
>> Hello,
>>   I've been using @RequiresPermissions to check a single permission at a
>> time, e.g.: @RequiresPermissions({"window:open"}).
>>   The problem is I need is to allow the same method to be executed by
>> people with distinct permissions, e.g.: @RequiresPermissions({"window:open",
>> "door:close"}).
>>   By reading the docs and looking at source code, I understood the list of
>> strings passed as a parameter to @RequiresPermissions builds up an "AND"
>> logical expression. Is there a way to build a "OR" logical expression? Is
>> there some kind of @RequiresAnyPermissions ?
>>
>> Thanks!
>
>

Re: Validation of multiple permissions using @RequiresPermissions

Posted by Felipe Carvalho <fe...@gmail.com>.
BTW, I found out https://issues.apache.org/jira/browse/SHIRO-175 relates
exactly to what I need, but I can't find the  @RequiresAnyPermissions(String[]
)  anywhere on the 1.1 or 1.2 distribution, though.

Does anyone know where can I find this annotation?

Thanks!

On Mon, Jul 30, 2012 at 6:12 PM, Felipe Carvalho
<fe...@gmail.com>wrote:

> Hello,
>   I've been using @RequiresPermissions to check a single permission at a
> time, e.g.: @RequiresPermissions({"window:open"}).
>   The problem is I need is to allow the same method to be executed by
> people with distinct permissions,
> e.g.: @RequiresPermissions({"window:open", "door:close"}).
>   By reading the docs and looking at source code, I understood the list of
> strings passed as a parameter to @RequiresPermissions builds up an "AND"
> logical expression. Is there a way to build a "OR" logical expression? Is
> there some kind of @RequiresAnyPermissions ?
>
> Thanks!
>