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

[PoC] Implement parser for permissions framework #519

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

GPaoloni
Copy link
Collaborator

@GPaoloni GPaoloni commented Dec 15, 2023

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 and target 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:

  • This PR does not means that we want/should remove the way we are currently evaluating the JSON-represented permissions rules. Instead, we could combine both approaches to use a more human readable DSL that is parsed and converted into the JSON-represented permissions rules.
  • This approach makes it easier to "validate" a JSON definition file IMO, as the rules for what is valid in the language are embedded in the parser, i.e. if a file parses then it's valid.

@GPaoloni GPaoloni changed the title Gian chi 2362 [PoC] Implement parser for permissions framework Dec 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant