Open DevinR528 opened 4 years ago
Hi, I saw your work and it was great. Just wondering, what do you think is the necessity of this approach at this stage?
Since you mentioned diesel, I have some other ideas. For example
casbin.toml
; what do you think is the necessity of this approach at this stage?
It would move a lot of code from runtime to being compile time checked. Removing the rhai
eval would improve performance considerably. It isn't a necessity but it would be nice, as everything works now. I do think using something like the casbin-proc-macro
example would allow for easy migrations and Model
schema generation.
@DevinR528 I think some day we really need a modeling language for casbin so that things can be verified and validated and converted to the correct format.
One of the more interesting features of rust are proc-macro's, I have wondered if it was possible to use a diesel style "schema" generator to create the
Model
and by doing so create a type that can hold policy lines and have this also used inenforce
possibly? This example is more a proof of concept to start a conversation about this feature.I created a repo with a minimal-ish example Casbin-proc-macro
Questions
Is it even wanted? How would this be integrated without breaking existing code or have a simple upgrade path ? Any other thoughts
Advantages
Policy
struct and the function to compare a request to a policyrhai
this is maybe a positive not sure about the trade offs