Open GopherJ opened 4 years ago
@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.
@hsluoyz auto save here means more SavePolicy
instead of AddPolicy/RemovePolicy/RemoveFiltered
etc. It's more for file-adapter like csv.
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.
@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.
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.