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
Looking at the documentation, it looks like you can pass a method to readable that accepts a model_instance. It does not appear that you can do the same for writable. Is there an alternative method of limiting writes based on permissions or authorization?
The use case here is that I'd like to enables writes on a resource only to the owner of that resource, i.e.:
@ribordy I believe the way you would go about this is by using a library like Pundit to perform your authorizations at the object or object attribute level.
Activity
caseyprovost commentedon Oct 2, 2019
@ribordy I believe the way you would go about this is by using a library like Pundit to perform your authorizations at the object or object attribute level.
caseyprovost commentedon Oct 2, 2019
This will also keep your authorization logic out of your resources, which will make testing and re-use far easier.
ribordy commentedon Oct 2, 2019
Thanks @caseyprovost! I had never heard of Pundit, but this seems like exactly what we're looking for.
Maybe it's worth adding a link to Pundit in the documentation, @richmolj?
onerinas commentedon Oct 5, 2024
Here is another way without using pundit: #134 (comment)