how to pass data from fluent security custom policy to controller

266 Views Asked by At

I am using fluent security in my project, In every Index action i want to fetch the access permission information and pass over it to controller to enable or disable buttons according to the role of user currently logged in. Is there a way to pass information from policy to controller. please help

Thanks in advance, Anoop

2

There are 2 best solutions below

0
Brett Allred On

You can store the roles in Session and pull them out of session. That is how fluent security would get the roles from you anyway for role based authentication.

If you look at their sample app, this is how they are doing it.

0
Kristoffer Ahl On

You can access all the information that FluentSecurity uses during execution through SecurityContext.Current and SecurityConfiguration.Current. But as Brett already mentioned you could also store the information you need elsewhere and access it directly.

https://github.com/kristofferahl/FluentSecurity/wiki/SecurityContext