I found this post about restricting an entire asset source and placing it below the root level: Is it possible to have secure (private) assets?
What I'd really like to do is be able to set the members-only restriction on a per-file basis, perhaps with a lightswitch field.
The imagined flow would be:
- user clicks a file link (anywhere, or even has a direct URL to the file)
- .htaccess sends all .pdf, .doc, etc requests to a download checker page
- download checker page sees if the requested file has the lightswitch checked
- if no, download the file
- if yes,
- if logged in, download the file
- if not logged in, show the registration / login page
- upon login or registration, start the file download
I'm still relatively new to Craft and have the feeling there may be specific twig/craft abilities that make this — or something very similar — simple. I don't necessarily need the code handed to me, just some ideas about what tools are available to help with this process.