You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi team, wondering how you'd approach this query that (I believe) needs an aliased join. Very hard to debug these rules (requires an edit and then running a few queries as a test suite) so hoping you might have some insight!
Here's a super simple MVP schema to illustrate; Users write Storys and collect them in Books.
Story
text: string
author: →User
book: →Book
User
id
username
Book
owner: →User
Here, a user is allowed to edit any Story for which they are an author. Fine, easy:
-- Story permission:
@request.auth.id =author.id
Now they want to invite some collaborators. The best way I can think of doing this (for arbitrary, large number of collaborators) is a separate collection that stores the permission. (i.e., I'd rather avoid a list of relations, since I think that's an anti-pattern here?)
In this toy example I want any user who has been granted permission to a book to be able to edit the constituent stories.
-- Story permission:-- I am the original creator,
(@request.auth.id =creator.id)
||-- Or I have been granted permission to a book:
???
It seems that this is a new feature with the @collection and aliasing capabilities, but I absolutely cannot decode the documentation here nor the answer here for this use-case. Hopefully some help here will aid other users in a similar situation :)
The text was updated successfully, but these errors were encountered:
j6k4m8
changed the title
API rule for "shared" records
API rule join syntax for "sharing" records with other users?
Mar 2, 2024
Hi team, wondering how you'd approach this query that (I believe) needs an aliased join. Very hard to debug these rules (requires an edit and then running a few queries as a test suite) so hoping you might have some insight!
Here's a super simple MVP schema to illustrate;
User
s writeStory
s and collect them inBook
s.Here, a user is allowed to edit any
Story
for which they are an author. Fine, easy:Now they want to invite some collaborators. The best way I can think of doing this (for arbitrary, large number of collaborators) is a separate collection that stores the permission. (i.e., I'd rather avoid a list of relations, since I think that's an anti-pattern here?)
In this toy example I want any user who has been granted permission to a book to be able to edit the constituent stories.
It seems that this is a new feature with the
@collection
and aliasing capabilities, but I absolutely cannot decode the documentation here nor the answer here for this use-case. Hopefully some help here will aid other users in a similar situation :)The text was updated successfully, but these errors were encountered: