def METHOD_NAME(
    request, *, component_interface_value_pk, **_
):
    try:
        user, _ = TokenAuthentication().authenticate(request)
    except (AuthenticationFailed, TypeError):
        user = request.user
    try:
        civ = ComponentInterfaceValue.objects.get(
            pk=component_interface_value_pk
        )
    except (MultipleObjectsReturned, ComponentInterfaceValue.DoesNotExist):
        raise Http404("No ComponentInterfaceValue found.")
    for perm, lookup in (
        ("algorithms.view_job", "outputs"),
        ("algorithms.view_job", "inputs"),
        ("archives.view_archiveitem", "values"),
        ("reader_studies.view_displayset", "values"),
    ):
        # Q | Q filters are very slow, this potentially does several db calls
        # but each is quite performant. Could be optimised later.
        if (
            get_objects_for_user(
                user=user,
                perms=perm,
            )
            .filter(**{lookup: civ})
            .exists()
        ):
            return protected_storage_redirect(
                name=civ.file.name, creator=user, component_interface_value=civ
            )
    raise PermissionDenied