I am following the Flask-potion tutorial and trying to secure my api. I am stuck on trying to figure out how to set permissions on the User endpoint so that a User cannot look at another User's record. Here is my code:
class UserResource(PrincipalResource):
class Meta:
model = User
permissions = {
'read': 'id'
}
class ArticleResource(PrincipalResource):
class Schema:
author = fields.ToOne('user')
class Meta:
model = Article
read_only_fields = ['author']
permissions = {
'create': 'editor',
'update': ['user:author', 'admin']
}
Would i need a custom permission to do this? It seems like this would be a common scenario.