Allow OR operation for the condition statement
tanonl opened this issue · 3 comments
I love this package. It is exactly what I needed. Simple and Clear
I have maybe one suggestion. Currently, the condition statement is basically a AND operation, all conditions in the list need to be True. It would good also to be able to have an OR operation.
e.g. "condition" : ["balance_is_positive", "account_is_blocked | is_manager"]
e.g. "condition" : "balance_is_positive & (is_manager | account_is_blocked)"
clever, I like it! would you be interested in submitting a pull request?
I created a pull request for that.
The easiest way I found is to use pyparsing.py to parse the expression.
I based myself on this example
Thanks. I finally got this merged in. I added a short note to the docs here:
https://rsinger86.github.io/drf-access-policy/object_level_permissions/
Glad to refine/expand as needed.