Closed arafat-java closed 3 years ago
@arafat-java use addPolicies()
.
I have been using addPolicies... but I need to first delete the existing policies for that object and hence would need the transaction management I tried updatePolicies but it seems that this adapter doesn't support updatePolicies
@arafat-java then we need to add updatePolicies()
to this adapter. @closetool can you take a look at it?
See some details at:
Even if we add the updatePolicies to this adapter wouldn't it still be a bug if e.SavePolicy() clears the database? Is there a specific reason for calling 'DELETE FROM casbin_rule_falcon AS "casbin_rule" WHERE (id IS NOT NULL) ' when e.SavePolicy is called
e.SavePolicy()
's logic is just deleting all in DB, then add all from local to DB. This is the expected behavior starting from the initial design.
Any rough estimate when the UpdatePolicies will be implemented in the adapter
@arafat-java PR ready.
@closetool PR merged, plz make a new release.
@arafat-java released: https://github.com/casbin/casbin-pg-adapter/releases/tag/v0.1.8
I pulled the latest code and I can see that UpdatePolicies is implemented. But the implementation is buggy. Have raised https://github.com/casbin/casbin-pg-adapter/issues/23 for the same
I wanted transaction in my project where I am using casbin-pg-adapter
So the approach that I am taking is
But when I call "e.SavePolicy()" it clears the database because it fires the following query
DELETE FROM casbin_rule_falcon AS "casbin_rule" WHERE (id IS NOT NULL)