Closed rhamzeh closed 10 months ago
~Sadly this grammar, while pretty robust doesnt catch define relation: rel1 and ([user] or thing)
as expected. Might have to validate it during transformation, unless we can spot a way to catch this with the grammar rules.~
Nevermind, think i got it.
This PR adds initial support for mixed operators
Description
Cases to be supported (both from and to DSL) (with no direct assignment):
define relation: (rel1 and rel2) but not rel3
define relation: ((rel1 and rel2) but not rel3)
# transformation back to DSL will not keep the extraneous surrounding bracketsdefine relation: rel1 and (rel2 but not rel3)
define relation: rel1 and ((rel2 but not rel3) or (rel4 and (rel5 but not rel6 from rel7)))
(with direct assignment, only if there is a single reference to the assignment and only if it is the first entry):
define relation: [user, user:*, user#follower with condition] or ((rel1 and rel2) but not rel3)
define relation: ([user] or ((rel1 and rel2)) but not rel3
# Note we can de-prioritize this as pending discussionCases NOT planned to supported yet, pending discussion: Anything involving multiple references to direct assignment, or the presence of direct assignment not as the first entry, or references to
self/this
:define relation: [user] as self | rel1 but not self
define relation: [user] as self | this but not rel1
define relation: rel1 but not [user]
define relation: [user] as self | (self or ((rel1 and rel2)) but not rel3
define relation: (rel3 or ((rel1 and rel2)) but not [user]
define relation: (rel3 or (([user] and rel2)) but not self
define relation: ([user] and allowed) or ([user] but not blocked]
References
Review Checklist
main