Dynamic Security Role Value - Tynamo Security

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

Dynamic Security Role Value - Tynamo Security

Matthew Bush
I want to dynamically set required roles at runtime dynamically rather than have them statically coded.  Is this possible?

Taken from the tynamo-security page (http://www.tynamo.org/tapestry-security+guide/ <http://www.tynamo.org/tapestry-security+guide/>)

<t:security.hasRole role="admin">
  <t:actionlink t:id="delete">delete user</t:actionlink>
</t:security.hasRole>
What I would like to be able to do is set the required role or role list based on a bound parameter, is that possible?

Example syntax -

<t:security.hasRole role=“${requiredRoles}">
  <t:actionlink t:id="delete">delete user</t:actionlink>
</t:security.hasRole>


Cheers,
Matthew Bush


Reply | Threaded
Open this post in threaded view
|

Re: Dynamic Security Role Value - Tynamo Security

Jens Breitenstein
Maybe use a <t:if> and move the role related code to your java page?

Von meinem iPhone gesendet

> Am 29.06.2016 um 08:24 schrieb Matthew Bush <[hidden email]>:
>
> I want to dynamically set required roles at runtime dynamically rather than have them statically coded.  Is this possible?
>
> Taken from the tynamo-security page (http://www.tynamo.org/tapestry-security+guide/ <http://www.tynamo.org/tapestry-security+guide/>)
>
> <t:security.hasRole role="admin">
>  <t:actionlink t:id="delete">delete user</t:actionlink>
> </t:security.hasRole>
> What I would like to be able to do is set the required role or role list based on a bound parameter, is that possible?
>
> Example syntax -
>
> <t:security.hasRole role=“${requiredRoles}">
>  <t:actionlink t:id="delete">delete user</t:actionlink>
> </t:security.hasRole>
>
>
> Cheers,
> Matthew Bush
>
>


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

Reply | Threaded
Open this post in threaded view
|

Re: Dynamic Security Role Value - Tynamo Security

Dmitry Gusev
In reply to this post by Matthew Bush
Just specify the prop: binding prefix explicitly, i.e.:

role="prop:dynamicRoles"

This parameter just uses literal: binding prefix by default.

Also make sure you read this:
http://tapestry.apache.org/component-parameters.html#ComponentParameters-BindingExpressions

On Wednesday, June 29, 2016, Matthew Bush <
[hidden email]> wrote:

> I want to dynamically set required roles at runtime dynamically rather
> than have them statically coded.  Is this possible?
>
> Taken from the tynamo-security page (
> http://www.tynamo.org/tapestry-security+guide/ <
> http://www.tynamo.org/tapestry-security+guide/>)
>
> <t:security.hasRole role="admin">
>   <t:actionlink t:id="delete">delete user</t:actionlink>
> </t:security.hasRole>
> What I would like to be able to do is set the required role or role list
> based on a bound parameter, is that possible?
>
> Example syntax -
>
> <t:security.hasRole role=“${requiredRoles}">
>   <t:actionlink t:id="delete">delete user</t:actionlink>
> </t:security.hasRole>
>
>
> Cheers,
> Matthew Bush
>
>
>

--
Dmitry Gusev

AnjLab Team
http://anjlab.com