Do we need to grant 'view private files' permission to authenticated users to be able to download files after purchase?

Created on 20 June 2024, 10 months ago

Problem/Motivation

I have an e-commerce website. I used the Commerce File module to upload pdf files for my products. But I have a problem: after paying, the authenticated user cannot download the file.

I was able to download the purchased file after granting these permissions to the authenticated user role:
- File entity: Document: download any document file
- File entity: View private files

But I noticed an issue where authenticated users can view files in private folders that have been uploaded not from the Commerce File field

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

💬 Support request
Status

Active

Version

2.1

Component

Documentation

Created by

🇻🇳Vietnam thiennd090395

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

Comments & Activities

  • Issue created by @thiennd090395
  • Status changed to Fixed 7 months ago
  • 🇮🇱Israel jsacksick

    Hi, apoligize for the late reply. The "view own commerce_license" permission is requred, you shouldn't need toallow viewing private files.
    Feel free to reopen if that didn't help.

  • Automatically closed - issue fixed for 2 weeks with no activity.

  • I seem to have the same issue.
    I granted "view own commerce_license" to registered users, but still get "access denied" when trying to download the file.
    Pfad: /commerce-file/3082/download. Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException: in Drupal\commerce_file\Controller\FileDownloadController->download() (Zeile 143 von /var/www/html/web/modules/contrib/commerce_file/src/Controller/FileDownloadController.php).

    the license itself if active...

  • the issue was, that I had running
    https://www.drupal.org/project/private_files_download_permission

    you have to bypass the folder where you upload the commerce files in the settings there

Production build 0.71.5 2024