Re:How We Turn Authorization Logic into SQL
by evancordell on Tuesday November 23, 2021 @04:45PM
(#29323963)
Rego is a nice language to use (IMO), but also has roots in logic programming and is closer to datalog than SQL.
I guess I'm just looking for a library + SQL shorthand that can easily interpolate request variables and session variables that gets declared in code where a route is declared. Just spitballing but something like `(blogs.id = $req.blogid).userid = $session.userid OR (users.id = $session.userid).isAdmin`.
This [0] is close but it doesn't have enough momentum to be well documented let alone usable as a library in every language you'd want (Go, C#, Python, Node.js, etc.).
Edit: Maybe OPA/Rego can in fact do this [1].
[0] https://github.com/mrumkovskis/tresql
[1] https://blog.openpolicyagent.org/write-policy-in-opa-enforce...