def get_per_field_update_scopes(cls, request, scopes_per_field):
        """
        Returns the list of required scopes for a PATCH endpoint where different
        request body fields are associated with different scopes.
        """

        assert request.method == "PATCH"

        # Even if no fields are modified, a PATCH request typically returns the
        # new state of the object, so we need to make sure the user has permissions
        # to view it.
        scopes = [cls.Scopes.VIEW]

        try:
            scopes.extend({scopes_per_field[field_name] for field_name in request.data})
        except KeyError as ex:
            raise PermissionDenied("Attempted to update an unknown field") from ex

        return scopes

        Returns the list of required scopes for a PATCH endpoint where different
        request body fields are associated with different scopes.
        
cvat/apps/iam/permissions.py