You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by Marc Logemann <ma...@gmail.com> on 2014/07/04 00:53:55 UTC

get ALL permissions via API

Hi,

using Shiro for some years now but currently facing an issue i cant solve.
I want to get back all permissions. Looking at the API, i ve found a
getAuthorizationInfo() method. Unfortunately its protected so that i cant
call it from my service class where i injected my custom realm.

I am also quite sure that injecting a realm is not a very nice way doing
things. But SecurityUtils.getSubject() doesnt get me anywhere in terms of
getting permissions.

I think if getAuthorizationInfo() would be public, i could simple get a
SimpleAuthorizationInfo object and everything is nice. Do i miss something
obvious here?

Thanks for input.

Marc

Re: get ALL permissions via API

Posted by Marc Logemann <ma...@gmail.com>.
Hi,

this would be an ugly hack trying to circumvent a not so elegant API
design. Right now i am getting an instance of the cache and get it from
there...
Am 04.07.2014 17:19 schrieb "juan manuel rojas ronquillo" <
juanrojas@rhemsolutions.com>:

> Just an Idea. If you have 2 sets: the permissions in the database and
> the permissions in shiro
> you can iterate over all your permissions and using isPermited method
> you can store the permissions of shiro in a list.
>
>
> 2014-07-04 6:40 GMT-05:00 Marc Logemann <ma...@gmail.com>:
> > Hi,
> >
> > of course i have the rights as 1:n relation from the user. But my realm
> in
> > shiro does some more magic. It checks if the admin role is present and
> > copies all permissions to the Subject. So i am not in sync with my
> database
> > anymore but shiro has the "correct" setting.
> >
> > So i cant just ask the database for all permissions, i need shiro to get
> > them to me. But this is a REAL hassle. To me the Subject interface lacks
> a
> > getAllPermissions().
> >
> > Any ideas how to get the list of permissions from Shiro?
> >
> >
> >
> >
> > 2014-07-04 2:51 GMT+02:00 juan manuel rojas ronquillo
> > <ju...@rhemsolutions.com>:
> >
> >> I don't know if this is posible. I never needed that, my dynamic
> >> permissions are in a database so I can fetch them.
> >> Can you detail your configuration and your use case so others can help?
> >>
> >> 2014-07-03 17:53 GMT-05:00 Marc Logemann <ma...@gmail.com>:
> >> > Hi,
> >> >
> >> > using Shiro for some years now but currently facing an issue i cant
> >> > solve. I
> >> > want to get back all permissions. Looking at the API, i ve found a
> >> > getAuthorizationInfo() method. Unfortunately its protected so that i
> >> > cant
> >> > call it from my service class where i injected my custom realm.
> >> >
> >> > I am also quite sure that injecting a realm is not a very nice way
> doing
> >> > things. But SecurityUtils.getSubject() doesnt get me anywhere in terms
> >> > of
> >> > getting permissions.
> >> >
> >> > I think if getAuthorizationInfo() would be public, i could simple get
> a
> >> > SimpleAuthorizationInfo object and everything is nice. Do i miss
> >> > something
> >> > obvious here?
> >> >
> >> > Thanks for input.
> >> >
> >> > Marc
> >
> >
>

Re: get ALL permissions via API

Posted by juan manuel rojas ronquillo <ju...@rhemsolutions.com>.
Just an Idea. If you have 2 sets: the permissions in the database and
the permissions in shiro
you can iterate over all your permissions and using isPermited method
you can store the permissions of shiro in a list.


2014-07-04 6:40 GMT-05:00 Marc Logemann <ma...@gmail.com>:
> Hi,
>
> of course i have the rights as 1:n relation from the user. But my realm in
> shiro does some more magic. It checks if the admin role is present and
> copies all permissions to the Subject. So i am not in sync with my database
> anymore but shiro has the "correct" setting.
>
> So i cant just ask the database for all permissions, i need shiro to get
> them to me. But this is a REAL hassle. To me the Subject interface lacks a
> getAllPermissions().
>
> Any ideas how to get the list of permissions from Shiro?
>
>
>
>
> 2014-07-04 2:51 GMT+02:00 juan manuel rojas ronquillo
> <ju...@rhemsolutions.com>:
>
>> I don't know if this is posible. I never needed that, my dynamic
>> permissions are in a database so I can fetch them.
>> Can you detail your configuration and your use case so others can help?
>>
>> 2014-07-03 17:53 GMT-05:00 Marc Logemann <ma...@gmail.com>:
>> > Hi,
>> >
>> > using Shiro for some years now but currently facing an issue i cant
>> > solve. I
>> > want to get back all permissions. Looking at the API, i ve found a
>> > getAuthorizationInfo() method. Unfortunately its protected so that i
>> > cant
>> > call it from my service class where i injected my custom realm.
>> >
>> > I am also quite sure that injecting a realm is not a very nice way doing
>> > things. But SecurityUtils.getSubject() doesnt get me anywhere in terms
>> > of
>> > getting permissions.
>> >
>> > I think if getAuthorizationInfo() would be public, i could simple get a
>> > SimpleAuthorizationInfo object and everything is nice. Do i miss
>> > something
>> > obvious here?
>> >
>> > Thanks for input.
>> >
>> > Marc
>
>

Re: get ALL permissions via API

Posted by Marc Logemann <ma...@gmail.com>.
Hi,

of course i have the rights as 1:n relation from the user. But my realm in
shiro does some more magic. It checks if the admin role is present and
copies all permissions to the Subject. So i am not in sync with my database
anymore but shiro has the "correct" setting.

So i cant just ask the database for all permissions, i need shiro to get
them to me. But this is a REAL hassle. To me the Subject interface lacks a
getAllPermissions().

Any ideas how to get the list of permissions from Shiro?




2014-07-04 2:51 GMT+02:00 juan manuel rojas ronquillo <
juanrojas@rhemsolutions.com>:

> I don't know if this is posible. I never needed that, my dynamic
> permissions are in a database so I can fetch them.
> Can you detail your configuration and your use case so others can help?
>
> 2014-07-03 17:53 GMT-05:00 Marc Logemann <ma...@gmail.com>:
> > Hi,
> >
> > using Shiro for some years now but currently facing an issue i cant
> solve. I
> > want to get back all permissions. Looking at the API, i ve found a
> > getAuthorizationInfo() method. Unfortunately its protected so that i cant
> > call it from my service class where i injected my custom realm.
> >
> > I am also quite sure that injecting a realm is not a very nice way doing
> > things. But SecurityUtils.getSubject() doesnt get me anywhere in terms of
> > getting permissions.
> >
> > I think if getAuthorizationInfo() would be public, i could simple get a
> > SimpleAuthorizationInfo object and everything is nice. Do i miss
> something
> > obvious here?
> >
> > Thanks for input.
> >
> > Marc
>

Re: get ALL permissions via API

Posted by juan manuel rojas ronquillo <ju...@rhemsolutions.com>.
I don't know if this is posible. I never needed that, my dynamic
permissions are in a database so I can fetch them.
Can you detail your configuration and your use case so others can help?

2014-07-03 17:53 GMT-05:00 Marc Logemann <ma...@gmail.com>:
> Hi,
>
> using Shiro for some years now but currently facing an issue i cant solve. I
> want to get back all permissions. Looking at the API, i ve found a
> getAuthorizationInfo() method. Unfortunately its protected so that i cant
> call it from my service class where i injected my custom realm.
>
> I am also quite sure that injecting a realm is not a very nice way doing
> things. But SecurityUtils.getSubject() doesnt get me anywhere in terms of
> getting permissions.
>
> I think if getAuthorizationInfo() would be public, i could simple get a
> SimpleAuthorizationInfo object and everything is nice. Do i miss something
> obvious here?
>
> Thanks for input.
>
> Marc