Check ownership
darmane opened this issue · comments
darmane commented
Hi! Is there any reusable way to check if the owner of a record is the one doing the request?
I have a token in the request that gives me the user's id and I want to fetch a record before UPDATE, READ_ONE or DELETE to check if the id of the relation 'User' is the same of the one in the token.
I think the callback 'onRequest' is the way to go, but I'm having troubles to write a reusable function to check that. Any help will be appreciated! :)
darmane commented
I found a way to handle it
Baptiste Adrien commented
🎉 Don't hesitate to share your solution here, it can help other people :)