Force reload of authorization rules.rb with declarative authorization
-
28-06-2021 - |
Question
I'm trying to use declarative authorization to make dynamic authorization so I'm storing the roles and permissions in the database.
The only problem I have is that authorization rules are loaded only once.
How can I force declarative authorization to reload the rules from inside a controller action so when I set new permissions to a role it works as I expect?
Solution
For those who are trying the same that I'm tried, I had to change the gem a little bit.
Check this commit to see what I did:
Now I can force to reload authorization rules by calling this method:
Authorization::Engine.force_reload
It works fine.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow