mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-11-04 01:47:59 +03:00 
			
		
		
		
	Merge pull request #1 from tdruez/master
Fixed Permissions.get_required_object_permissions for #4927
This commit is contained in:
		
						commit
						e9a68e575a
					
				| 
						 | 
				
			
			@ -5,6 +5,7 @@ from __future__ import unicode_literals
 | 
			
		|||
 | 
			
		||||
from django.http import Http404
 | 
			
		||||
 | 
			
		||||
from rest_framework import exceptions
 | 
			
		||||
from rest_framework.compat import is_authenticated
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -108,6 +109,10 @@ class DjangoModelPermissions(BasePermission):
 | 
			
		|||
            'app_label': model_cls._meta.app_label,
 | 
			
		||||
            'model_name': model_cls._meta.model_name
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if method not in self.perms_map:
 | 
			
		||||
            raise exceptions.MethodNotAllowed(method)
 | 
			
		||||
 | 
			
		||||
        return [perm % kwargs for perm in self.perms_map[method]]
 | 
			
		||||
 | 
			
		||||
    def has_permission(self, request, view):
 | 
			
		||||
| 
						 | 
				
			
			@ -169,6 +174,10 @@ class DjangoObjectPermissions(DjangoModelPermissions):
 | 
			
		|||
            'app_label': model_cls._meta.app_label,
 | 
			
		||||
            'model_name': model_cls._meta.model_name
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if method not in self.perms_map:
 | 
			
		||||
            raise exceptions.MethodNotAllowed(method)
 | 
			
		||||
 | 
			
		||||
        return [perm % kwargs for perm in self.perms_map[method]]
 | 
			
		||||
 | 
			
		||||
    def has_object_permission(self, request, view, obj):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user