verbb / vizy

A flexible visual editor for Craft CMS
Other
43 stars 8 forks source link

Volumes with private filesystem don't appear in "Available Volumes" field setting #256

Open yoannisj opened 9 months ago

yoannisj commented 9 months ago

Describe the bug

When setting up a Local Folder pointing to a path outside the public web folder (e.g. storage/private-files in the example folder structure below), it does not appear in Vizy fields’ "Advanced Settings > Available Volumes" setting. Surprisingly, it does appear as an option in the "Default Upload Location" setting, so Vizy does find the volume.

Example Folder Structure:

config/
storage/
- runtime/
- ...
- private-files/
templates/
translations/
web/
- public-files/
- cpresources/
- index.php

Steps to reproduce

  1. Create the storage/private-files and web/public-files directories from the example folder structure above
  2. Create a "Local Folder" Filesystem named "Private Files" with the "Base Path" setting pointing to storage/private-files
  3. Create a "Local Folder" Filesystem named "Public Files" with the "Base Path" setting pointing to web/public-files
  4. Create a Volume named "Private Assets" and select the "Private Files" filesystem in its "Asset Filesystem" setting
  5. Create a Volume named "Public Assets" and select the "Public Files" filesystem in its "Asset Filesystem" setting
  6. Create a new Vizy field and open the "Advanced Settings" panel
  7. The "Public Assets" volume appears in the Vizy field's "Available Volumes" setting, but the "Private Assets" volume is missing
  8. Notice that both the "Public Assets" and the "Private Assets" volumes appear in the Vizy field's "Default Upload Location" setting

Craft CMS version

Craft Pro 4.4.17

Plugin version

2.1.9

Multi-site?

Yes

Additional context

The reason we need a "Private Assets" volume with a private filesystem is to allow content editors to upload images which are not publicly available until they are effectively used by the front-end. To make this work, we select the "Public Files" filesystem in the volume's "Transform Filesystem" setting, and the images become public when a transform is applied by the front-end code.

I tried switching the "Transform Filesystem" setting from "Public Files" to "Private Files" and that does not influence the issue described here. I did upload an image to the "Private Assets" Volume and confirm that Craft can read and write in the underlying storage/private-files directory.

I have Craft's "allowAdminChanges" setting turned off, so I only tested this in local development environment:

engram-design commented 9 months ago

I will say that by default, Vizy will require volumes (and their filesystem) to have publicly accessible files in order to work. I see from your context explanation your unique way of handling your requirements. I'll need to look at how we can address this.

yoannisj commented 9 months ago

@engram-design great, thanks! I'd like to add that the use-case described above has been a requirement for more than one of my company's projects already, so it'd be great if Vizy ends up handling this somehow. Let me know if I can help in any way :) !