-
-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Database grows unexpectedly using EFCore adapter #176
Comments
It may be a bug, casbin should keep no duplicate rules in the model. |
While working on the repro I discovered what the issue is/was. I was calling enforcer.SavePolicyAsync() while AutoSave was enabled. So the issue was really a couple of things:
Not sure if item 1. is by design? If so it makes for a very crude mechanism to it hard to keep the database in sync with the enforcer. Also it means that calling SavePolicy with AutoSave enabled is always (?) a mistake. So perhaps this is not considered a bug, and the ticket can be closed, but I would like your comment on:
|
Thank you for the feedback.
|
Thanks @sagilio So in the short term I think adding "de-duplication' on SavePolicy() is necessary and will make SavePolicy() behave closer to the expected . (How does it behave in other implementations on other platforms?) As for other improvement for IAdapter v2.x, I don't have anything concrete right now, but I believe the lack of rule identity may cause some friction. In the next few days we will be implementing a couple of synchronization scenarios, and I will let you know if we discover any "friction" implementing those. Perhaps we will discover if/how IAdapter can be improved? |
Look forward to your discoveries and welcome to comment at #184 anytime. |
In our solution we're noticing that the Casbin table grows "unexpectedly". Before I start producing a simpler repro I thought I should check if my expectations make sense.
I would expect there not to be any duplicate rows in the table, and that the rows correspond to individual AddXXC calls. But when we're adding entries using either
enforcer.AddNamedPolicyAsync()
orenforcer.AddRoleForUserAsync()
we're seeing that a single call to enforcer.AddXXX() produces duplicate (rows that differ only in the PK).Is this to be expected?
Not sure if it's relevant but we're using a custom CasbinDbContext, and a Postgres database with the adapter.
The text was updated successfully, but these errors were encountered: