Skip to content
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

auto-loading, auto-saving feature #194

Open
GopherJ opened this issue Jul 19, 2020 · 4 comments
Open

auto-loading, auto-saving feature #194

GopherJ opened this issue Jul 19, 2020 · 4 comments

Comments

@GopherJ
Copy link
Member

GopherJ commented Jul 19, 2020

auto-loading:

https://github.com/casbin/casbin/blob/2ab8eb7c140a19a2687c7b0a14331756242c5741/enforcer_synced.go#L55-L83

auto-saving:

This is an unimplemented feature in casbin golang & casbin-rs, it can be used for FileAdapter for example.

@GopherJ GopherJ added this to the v2.0.0 milestone Jul 19, 2020
@hsluoyz
Copy link
Member

hsluoyz commented Jul 25, 2020

@GopherJ we already have the AutoSave feature (for a not short time): https://casbin.org/docs/en/adapters#autosave. It's an optional feature that an adapter can choose to support it or not. Doesn't Casbin-RS support such mechanism?

The built-in file adapter usually doesn't implement AutoSave, because files are mostly used as static resources and will only be loaded at initial time. A user usually doesn't want to read & write data to files. They will choose to use DB for such requirement.

@GopherJ
Copy link
Member Author

GopherJ commented Jul 25, 2020

@hsluoyz auto save here means more SavePolicy instead of AddPolicy/RemovePolicy/RemoveFiltered etc. It's more for file-adapter like csv.

@hsluoyz
Copy link
Member

hsluoyz commented Jul 25, 2020

Like I said, I don't think there are many people that want to save rules into CSV files as a long-term solution. Making efforts into this area would be not very fruitful, unless some important customers request this feature explicitly.

@GopherJ
Copy link
Member Author

GopherJ commented Jul 25, 2020

@hsluoyz I don't think there will be a great effort needed to implement this type of small thing.

currently casbin binds too tighltly with databases, that means if there is no database, then there is no persistence.

This isn't really good, because some simple use cases, users will not want to add databases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

No branches or pull requests

2 participants