Skip to content

permission_classes in ListBulkCreateUpdateAPIView #73

@nguyenducthuanuet

Description

@nguyenducthuanuet

I have a permisson class like this

from rest_framework import status, permissions
class IsOwnerOrReadOnly(permissions.BasePermission):
    """
    Custom permission to only allow owners of an object to edit it.
    """

    def has_object_permission(self, request, view, obj):
        # Read permissions are allowed to any request,
        # so we'll always allow GET, HEAD or OPTIONS requests.
        if request.method in permissions.SAFE_METHODS:
            return True

        # Write permissions are only allowed to the owner of the snippet.
        return obj.user == request.user

and my ViewSet:

class CompanyView(ListBulkCreateUpdateAPIView):
     serializer_class = company_serializer.CompanySerializer
     permission_classes = (IsOwnerOrReadOnly,)

But When I make a POST/PUT request to insert or update many records, My ViewSet does not use Permission class to check permissions.
How to add permission classes to Bulk ViewSet ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions