Skip to content

More granular "row level" authorisation #1612

Answered by Skn0tt
will-hart asked this question in General
Discussion options

You must be logged in to vote

I assume that this would be done at the query level?

Correct. Currently, the best practice is to perform authorisation checks at the query / mutation level.

For your example, you could use Prisma's AND / OR operators to perform query à la "find a post with this ID, which is marked public or has the session's user as its creator".
If nothing's found, that means there either isn't a post with that ID or the user isn't allowed to access it - which makes no difference for your usecase :)

Blitz calls this "secure data, not pages".

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by will-hart
Comment options

You must be logged in to vote
1 reply
@will-hart
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants