Check for exsitence of roles

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

Check for exsitence of roles

Bart van Leeuwen
Hi,

I was wondering if it is possible to check the realm for existence or roles.

My use case is that I allow dynamic creating of UI elements which can be restricted to roles, however if a role does not exist the restriction should be flagged since it is not possible to satisfy it in the current realm.

Met Vriendelijke Groet / With Kind Regards
Bart van Leeuwen



twitter: @semanticfire

tel. +31(0)6-53182997
Netage B.V.
http://netage.nl
Esdoornstraat 3
3461ER Linschoten
The Netherlands
Reply | Threaded
Open this post in threaded view
|

Re: Check for exsitence of roles

Brian Demers
Take a look at the 'has' methods: https://shiro.apache.org/authorization.html#programmatic-authorization
Those will return boolean values, as opposed to the `check` methods which will throw an AuthorizationException

On Thu, May 31, 2018 at 2:18 PM, Bart van Leeuwen <[hidden email]> wrote:
Hi,

I was wondering if it is possible to check the realm for existence or roles.

My use case is that I allow dynamic creating of UI elements which can be restricted to roles, however if a role does not exist the restriction should be flagged since it is not possible to satisfy it in the current realm.

Met Vriendelijke Groet / With Kind Regards
Bart van Leeuwen



twitter: @semanticfire

tel. +31(0)6-53182997
Netage B.V.
http://netage.nl
Esdoornstraat 3
3461ER Linschoten
The Netherlands

Reply | Threaded
Open this post in threaded view
|

Re: Check for exsitence of roles

Bart van Leeuwen
Thx for the quick reply!

This only works from the context of a user, not from the context of a realm right ?

Met Vriendelijke Groet / With Kind Regards
Bart van Leeuwen



twitter: @semanticfire

tel. +31(0)6-53182997
Netage B.V.
http://netage.nl
Esdoornstraat 3
3461ER Linschoten
The Netherlands




From:        Brian Demers <[hidden email]>
To:        [hidden email]
Date:        31-05-2018 20:22
Subject:        Re: Check for exsitence of roles




Take a look at the 'has' methods: https://shiro.apache.org/authorization.html#programmatic-authorization
Those will return boolean values, as opposed to the `check` methods which will throw an AuthorizationException

On Thu, May 31, 2018 at 2:18 PM, Bart van Leeuwen <bart_van_leeuwen@...> wrote:
Hi,

I was wondering if it is possible to check the realm for existence or roles.


My use case is that I allow dynamic creating of UI elements which can be restricted to roles, however if a role does not exist the restriction should be flagged since it is not possible to satisfy it in the current realm.


Met Vriendelijke Groet / With Kind Regards
Bart van Leeuwen



twitter: @semanticfire

tel. +31(0)6-53182997

Netage B.V.

http://netage.nl
Esdoornstraat 3
3461ER Linschoten

The Netherlands




Reply | Threaded
Open this post in threaded view
|

Re: Check for exsitence of roles

Brian Demers
Right, but the usage pattern is typically from the user/subject, not the realm.  The realm(s) indirectly populates the user/subject's roles




On Thu, May 31, 2018 at 2:24 PM, Bart van Leeuwen <[hidden email]> wrote:
Thx for the quick reply!

This only works from the context of a user, not from the context of a realm right ?

Met Vriendelijke Groet / With Kind Regards
Bart van Leeuwen



twitter: @semanticfire

tel. +31(0)6-53182997
Netage B.V.
http://netage.nl
Esdoornstraat 3
3461ER Linschoten
The Netherlands




From:        Brian Demers <[hidden email]>
To:        [hidden email]
Date:        31-05-2018 20:22
Subject:        Re: Check for exsitence of roles




Take a look at the 'has' methods: https://shiro.apache.org/authorization.html#programmatic-authorization
Those will return boolean values, as opposed to the `check` methods which will throw an AuthorizationException

On Thu, May 31, 2018 at 2:18 PM, Bart van Leeuwen <[hidden email]> wrote:
Hi,

I was wondering if it is possible to check the realm for existence or roles.


My use case is that I allow dynamic creating of UI elements which can be restricted to roles, however if a role does not exist the restriction should be flagged since it is not possible to satisfy it in the current realm.


Met Vriendelijke Groet / With Kind Regards
Bart van Leeuwen



twitter: @semanticfire

tel. +31(0)6-53182997

Netage B.V.

http://netage.nl
Esdoornstraat 3
3461ER Linschoten

The Netherlands