Closed adamwoolhether closed 2 years ago
@tangyang9464 @closetool @sagilio
@adamwoolhether
Closing the my application, adding new rules to the policies file, and restarting the application, newly added policies are not added.
See: https://casbin.org/docs/en/adapters#autosave
This also begs the question, how to update policies deleted from the file, how are we supposed "sync" our db's casbin_rule table with our source-policy file, or is this possible?
See: https://casbin.org/docs/en/adapters#migrateconvert-between-different-adapter
@adamwoolhether
Closed as resolved.
Per documentaiton: "AddPolicies adds authorization rules to the current policy. If the rule already exists, the function returns false for the corresponding rule and the rule will not be added. Otherwise the function returns true for the corresponding rule by adding the new rule."
Upon loading policies to a clean DB table, all policies are updated.
Closing the my application, adding new rules to the policies file, and restarting the application, newly added policies are not added.
Instead, I have to range over my rules
[][]string
calling,AddPolicy
each iteration to order to add the new policies.This also begs the question, how to update policies deleted from the file, how are we supposed "sync" our db's
casbin_rule
table with our source-policy file, or is this possible? Right now, the only solution i have is the callClearPolicy()
andAddPolicies()
each time at app-initialization.