Allow access to files without sharing them

Created on 14 July 2023, 12 months ago

Problem/Motivation

Researching this module for a possible use case I have. Really nice work, a lot of what I need just works out of the box. i have one client requirement around files where I want to figure out if there's interest to support it in this module or a contrib project.

We want to allow access to files without having to share them all across the different sites as there can be a lot and they can be quite big. At the same time, they are private and not accessible without authentication.

My initial plan before investigating this project was to use a custom media source plugin that then uses an API exposed by the server to pass the file through. Seeing that this already syncs the file entity, I'm thinking to go a level or two deeper and handle it as a stream wrapper. Judging from how other things work, it would probably be best if the server already alters the jsonapi response and returns the uri as 'entitysharefile://uuid/filename.pdf' or something like that. The client then has a module that provides that stream wrapper and passes requests to it to the server. Maybe passing through, maybe a short-time access token that allows access direct access by the browser. Non-private files could possible be linked directly.

I do plan to implement this, just looking if that's something that might be useful for others and if there's any feedback on the architecture.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡¨πŸ‡­Switzerland Berdir Switzerland

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Berdir
  • πŸ‡«πŸ‡·France Grimreaper France πŸ‡«πŸ‡·

    Hi,

    Really nice work, a lot of what I need just works out of the box.

    Thanks!

    I don't know if this is something that should be put in Entity Share, maybe contrib. A stream wrapper selector.

    Regarding your use case, to be generic, I also would have thought about a custom stream wrapper (maybe https://www.drupal.org/project/remote_stream_wrapper β†’ ? But it may not handle private files).

    So for Entity Share, you would only have to implement either a JSON:API Extras field enhancer if you want to change for all files JSON:API output from server side. Or an import processor plugin that will alter the JSON:data on client side before unserialization.

    The import processor plugin may offer more flexibility depending on other business rules if needed.

Production build 0.69.0 2024