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
[Feature] Changing targeted tablename after newAdaptorByDb() #110
Comments
@normangoh use NewAdapterByDBUseTableName(), see: #74 |
@normangoh replied: I just tried using NewAdapterByDBUserTableName() but it does not work with periods, since I am target another schema I need to use schema1.casbin_rule and schema2.casbin_rule for example. |
@closetool |
@normangoh It works. If you pass in different schema by Line 92 in b448b9d
|
@closetool I already tried using the func you mentioned and it does not work with something like the following.
Regarding the alternative solution you mentioned, will that requires a new connection to be setup? Since I am planning to use it for a SAAS app I can foresee a multiple requests on going. If the app creates a connection everytime they need to read from another schema I think that it will not be very ideal. I am looking for a solution that does not need to create a new connection and let me read from another table in another schema. |
@normangoh I found something helpful in grom's doc, https://gorm.io/docs/dbresolver.html, it seems the resolver keeps multiple connections either. If you still need this feature, I could make a pr for you. |
🎉 This issue has been resolved in version 3.3.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Want to prioritize this issue? Try:
Is your feature request related to a problem? Please describe.
I am trying to build a SAAS and I would need to check permission from different schema depending on the request. Currently, I think that Casbin does not support changing schema when reading from the DB.
Describe the solution you'd like
It will be great if we can first create an adaptor with something like newAdaptorByDb() and then switch the tablename afterwards. So we can use something like schema1.casbin_rule or schema2.casbin_rule if we need to read permissions from different schema and this feature will not require a new adaptor creation.
Describe alternatives you've considered
None.
Additional context
None.
The text was updated successfully, but these errors were encountered: