简体   繁体   中英

how to pass data from fluent security custom policy to controller

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM