mirror of https://github.com/interlegis/sapl.git
LeandroRoberto
8 years ago
9 changed files with 120 additions and 20 deletions
@ -1,4 +1,5 @@ |
|||||
from django.core.paginator import EmptyPage |
from django.core.paginator import EmptyPage |
||||
|
from django.utils.encoding import force_text |
||||
from rest_framework import pagination |
from rest_framework import pagination |
||||
from rest_framework.response import Response |
from rest_framework.response import Response |
||||
|
|
@ -0,0 +1,17 @@ |
|||||
|
from rest_framework.permissions import DjangoModelPermissions |
||||
|
|
||||
|
|
||||
|
class DjangoModelPermissions(DjangoModelPermissions): |
||||
|
|
||||
|
perms_map = { |
||||
|
'GET': ['%(app_label)s.list_%(model_name)s', |
||||
|
'%(app_label)s.detail_%(model_name)s'], |
||||
|
'OPTIONS': ['%(app_label)s.list_%(model_name)s', |
||||
|
'%(app_label)s.detail_%(model_name)s'], |
||||
|
'HEAD': ['%(app_label)s.list_%(model_name)s', |
||||
|
'%(app_label)s.detail_%(model_name)s'], |
||||
|
'POST': ['%(app_label)s.list_%(model_name)s'], |
||||
|
'PUT': ['%(app_label)s.change_%(model_name)s'], |
||||
|
'PATCH': ['%(app_label)s.change_%(model_name)s'], |
||||
|
'DELETE': ['%(app_label)s.delete_%(model_name)s'], |
||||
|
} |
Loading…
Reference in new issue