tskrio / seedling

Tasks for Today
https://tskr.io
MIT License
15 stars 7 forks source link

Setup Row Level CRUD for things like Users. e.g. the logged in user should be able to edit their own user even if they shouldnt be able to edit others. #100

Closed jacebenson closed 2 years ago

jacebenson commented 2 years ago

I'm not sure the best way to do this, at the time of writing, this can be accomplished with before read rules. I don't like this but, it would make life pretty simple. Just modify the query appropriately for the logged in user.
If they only can see their records, when they do a search for preferences containing language, then append { userId: session.user.id } to each of their queries.

Another option would be to make another folder for these kind of rules where by role we limit what they can see.

jacebenson commented 2 years ago

104 is part of this.

jacebenson commented 2 years ago

You can add where clauses to update, and delete calls in prisma. This should simplify RLS for api side.

jacebenson commented 2 years ago

This will be handled with "before" "read" and "readAll" rules to add proper where clauses.

jacebenson commented 2 years ago

This is done and just needs some docs on it here: https://github.com/tskrio/docs/issues/10