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
[Bug] LoadPolicy is not working properly since v2.7.2 to v2.39.0 with mongoadapter v2 #916
Comments
@tangyang9464 @closetool @sagilio |
@srPuebla I didn't get what you meant. I cannot reproduce by following your reproduce steps. It works well with version |
Hi @Abingcbc Of course, maybe i didn´t explain myself. I am gonna put a example main, and lets execute with the versions 2.7.1 and the others, ok? Lets GO! Full Main.go:
With version 2.7.1 or less:
2º We execute the program second time. The result is:
3º We check the mongodb and we find the document:
With version 2.7.2 or more:
2º We execute the program second time. The result is:
3º We check the mongodb and we find several documents:
I expect the behaviour of v2.7.1 or less. With this example, could you reproduce the problem? Thanks and i hope this helps!! |
Hi again @Abingcbc I think that the problem is with mongodb-adapter If you update the version to v3, github.com/casbin/mongodb-adapter/v3 v3.2.1, then it works properly The point is... that i cant migrate from v2 to v3 cause i have too many policies on my PRO enviroment and when i load v3, mongoadapter fails. But this is not the problem of this library. Thank you so mucho for help, i hope that it helps others. If you get this issue, update the last version! github.com/casbin/mongodb-adapter/v3 v3.2.1 Regards! |
@srPuebla Thanks for your reply❤️ I have reproduced the bug and I will work on this issue |
I think the root cause is that from One way to work around is manually adding all policies in You can call this function immediately after calling |
Discussed with @Abingcbc and we believe it has no need to fix. |
Want to prioritize this issue? Try:
Describe the bug
I am using casbin in APIs, with echoframework. Instead a file, i am working with mongo-adapter.
I have configured the next below:
It is working successfully, however, i am trying to update to last version v2.39.0 and i am geting problems with LoadPolicy.
I was using v2.7.1, and if you update to v2.7.2, then you get the problem
To Reproduce
Steps to reproduce the behavior:
1º Add a Policy
2º Execute a LoadPolicy:
3º Execute again step 1, and you can insert again a Policy (in spite of the fact that is repeated):
4º You can repeat that, and in Database you will find this:
Expected behavior
A clear and concise description of what you expected to happen.
When you LoadPolicy, you have to read from DB and update the cached policy, like in 2.7.1 version. For example, if you have several PODs running this, you can use SyncEnforcer to LoadPolicy of other pods who are making the changes.
Screenshots
Not neccessary
Desktop (please complete the following information):
Not
Smartphone (please complete the following information):
Not
Additional context
I hope it helps.
Thanks for this module, its amazing.
The text was updated successfully, but these errors were encountered: