Disable unused API methods and require model add permissions for OPTIONS.

This commit is contained in:
Christopher Charbonneau Wells 2017-12-05 16:40:10 -05:00
parent ed84f950bc
commit c37dabdbd1
1 changed files with 4 additions and 4 deletions

View File

@ -7,10 +7,10 @@ from rest_framework.permissions import DjangoModelPermissions
class BabyBuddyDjangoModelPermissions(DjangoModelPermissions): class BabyBuddyDjangoModelPermissions(DjangoModelPermissions):
perms_map = { perms_map = {
'GET': ['%(app_label)s.view_%(model_name)s'], 'GET': ['%(app_label)s.view_%(model_name)s'],
'OPTIONS': [], 'OPTIONS': ['%(app_label)s.add_%(model_name)s'],
'HEAD': [], 'HEAD': [],
'POST': ['%(app_label)s.add_%(model_name)s'], 'POST': ['%(app_label)s.add_%(model_name)s'],
'PUT': ['%(app_label)s.change_%(model_name)s'], # 'PUT': ['%(app_label)s.change_%(model_name)s'],
'PATCH': ['%(app_label)s.change_%(model_name)s'], # 'PATCH': ['%(app_label)s.change_%(model_name)s'],
'DELETE': ['%(app_label)s.delete_%(model_name)s'], # 'DELETE': ['%(app_label)s.delete_%(model_name)s'],
} }