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?

Was it helpful?

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:

https://github.com/bishma-stornelli/declarative_authorization/commit/b508c3c008ed4b72e9fe2ec7802bfafbc6c4590b

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
scroll top