-
Notifications
You must be signed in to change notification settings - Fork 6
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
build: add support for identity backlinks to permissions package #1323
Conversation
@jonbretman Having two independent expression-to-SQL builders is just silly (which I think we both agree on). But if we do move runtime permissions to use this permissions package, then we still end up with two independent expression-to-SQL builders because I am still more in favour of having functions permissions rather use the actions package query builder instead, because then we have one SQL builder AND because I think the action builder package is covering more use cases, has more tests, and should be more battle-hardened by now (by virtue of action I think we're a little stuck on this point. Perhaps it's also due to me feeling more comfortable with the runtime permissions code and you feeling more comfortable with the functions permissions code. But at the end of the day I also just want this unified. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
Maybe we need some tests which test cases such as:
Backlinking to some field:
create createFilm() {
@permission(expression: ctx.identity.user.isTeller)
}
And something a little more complicated:
create admit() with (film.id) {
@permission(expression: admit.identity.user.age >= admit.film.ageRestriction)
}
And backlinking deeper down the relationship graph:
create createFilm() {
@permission(expression: ctx.identity.user.team in film.teams.team)
}
@davenewza if you have an idea on technically how to use the runtime actions query builder (in Go) in functions (in other languages) I'm very happy to discuss it - but personally I can't think of a viable way of doing this. Go's WASM support just isn't there, and calling out to the runtime for every query will be way too slow. I also think the |
Good idea - I'll add some like this. |
c5fd7ba
to
89f6216
Compare
permissions
package to support backlinks fromctx.identity
I strongly feel that we should update the runtime permissions stuff to use the
permissions
package SQL generation so that we can be sure behaviour is the same between runtime and functions. Looking at the runtime code I don't think this should be too tricky as ultimately we just execute some SQL