You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shiro.apache.org by aloleary <al...@gmail.com> on 2009/11/17 13:42:21 UTC
Programatically adding Permissions
Hello,
Simple question really - what is the best approach for adding permissions
(wildcard is perfect) at runtime ?
I need to programatically setup a users permissions.
Any tips/hints appreciated
thanks
-A-
--
View this message in context: http://n2.nabble.com/Programatically-adding-Permissions-tp4018307p4018307.html
Sent from the Shiro User mailing list archive at Nabble.com.
Re: Programatically adding Permissions
Posted by aloleary <al...@gmail.com>.
Ok thanks - I already have a custom realm as it is for a standalone client
app that uses simple "pin" access not userandpassword... so i will look into
the existing Shiro classes to see what i need to add to my realm for adding
permission support
thanks
Moataz Elmasry-3 wrote:
>
> Adding/deleting permissions to my understanding would mean changing the
> contents of the realm (properties file, database, etc...).
> shiro only offers a general use realm, but nothign specific, since shiro
> can't forsee what structure your realm have.
> So my answer to your question would be: you can't add permissions
> programatically only with shiro, you'll need to extend your own realm
> and add your add/delete functions.
>
> Hope this helps
> Moataz
>
>
> aloleary wrote:
>> Hello,
>> Simple question really - what is the best approach for adding
>> permissions
>> (wildcard is perfect) at runtime ?
>>
>> I need to programatically setup a users permissions.
>>
>> Any tips/hints appreciated
>>
>> thanks
>> -A-
>>
>
>
>
--
View this message in context: http://n2.nabble.com/Programatically-adding-Permissions-tp4018307p4018920.html
Sent from the Shiro User mailing list archive at Nabble.com.
Re: Programatically adding Permissions
Posted by Les Hazlewood <lh...@apache.org>.
Hi Al,
Moataz is correct - you can't use the Shiro API to directly add
permissions, roles, groups or mappings thereof because that requires
intimate knowledge of your application's data model, which Shiro can't
possibly know.
A fairly common solution is to have something like a
UserManager/UserService (or similar) that performs these
additions/associations and then have your Realm use that same service
when doing the lookups for authentication and authorization.
HTH,
Les
On Tue, Nov 17, 2009 at 8:01 AM, Moataz Elmasry
<za...@googlemail.com> wrote:
> Adding/deleting permissions to my understanding would mean changing the
> contents of the realm (properties file, database, etc...).
> shiro only offers a general use realm, but nothign specific, since shiro
> can't forsee what structure your realm have.
> So my answer to your question would be: you can't add permissions
> programatically only with shiro, you'll need to extend your own realm and
> add your add/delete functions.
>
> Hope this helps
> Moataz
>
>
> aloleary wrote:
>>
>> Hello, Simple question really - what is the best approach for adding
>> permissions
>> (wildcard is perfect) at runtime ?
>>
>> I need to programatically setup a users permissions.
>>
>> Any tips/hints appreciated
>>
>> thanks
>> -A-
>>
>
>
Re: Programatically adding Permissions
Posted by Moataz Elmasry <za...@googlemail.com>.
Adding/deleting permissions to my understanding would mean changing the
contents of the realm (properties file, database, etc...).
shiro only offers a general use realm, but nothign specific, since shiro
can't forsee what structure your realm have.
So my answer to your question would be: you can't add permissions
programatically only with shiro, you'll need to extend your own realm
and add your add/delete functions.
Hope this helps
Moataz
aloleary wrote:
> Hello,
> Simple question really - what is the best approach for adding permissions
> (wildcard is perfect) at runtime ?
>
> I need to programatically setup a users permissions.
>
> Any tips/hints appreciated
>
> thanks
> -A-
>