(self, request, view, obj=None)
return result
Perform basic permissions checking before delegating to the appropriate
        method based on the request method.
Perform basic permissions checking before delegating to the appropriate
        method based on the request method.
Perform basic permissions checking before delegating to the appropriate method based on the request method .
def check_permissions(self, request, view, obj=None):
        """
        Perform basic permissions checking before delegating to the appropriate
        method based on the request method.
        """

        # Don't allow anonymous users. 401, not 403, hence no raised exception.
        if not request.user or request.user.is_anonymous:
            return False

        # Always allow superusers
        if getattr(view, 'always_allow_superuser', True) and request.user.is_superuser:
            return True

        # Check if view supports the request method before checking permission
        # based on request method.
        if request.method.upper() not in view.allowed_methods:
            raise MethodNotAllowed(request.method)

        # Check permissions for the given view and object, based on the request
        # method used.
        check_method = getattr(self, 'check_%s_permissions' % request.method.lower(), None)
        result = check_method and check_method(request, view, obj)
        if not result:
            raise PermissionDenied()

        return result
def check_permissions ( self , request , view , obj = None ) : # Don't allow anonymous users. 401, not 403, hence no raised exception. if not request . user or request . user . is_anonymous : return False # Always allow superusers if getattr ( view , 'always_allow_superuser' , True ) and request . user . is_superuser : return True # Check if view supports the request method before checking permission # based on request method. if request . method . upper ( ) not in view . allowed_methods : raise MethodNotAllowed ( request . method ) # Check permissions for the given view and object, based on the request # method used. check_method = getattr ( self , 'check_%s_permissions' % request . method . lower ( ) , None ) result = check_method and check_method ( request , view , obj ) if not result : raise PermissionDenied ( ) return result