[PoC] Implement parser for permissions framework #519
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR proposes a different approach to #520.
Here, I exemplify how we might use parser combinators to parse the expressions and map them to functions. This functions are in turn evaluated against
user
andtarget
for each action as usual.The advantage of moving to an approach like this is that we can simplify the expressions in the permissions frameworks with and with relatively little effort change from expressions like
"editContact": [["isSupervisor"], ["isOwner", { "createdHoursAgo": 24 }]]
to an analogous like
"editContact": "isSupervisor OR (isOwner AND createdHoursAgo(24))"
.NOTES: