View data export with custom table doesn't work if user is not admin

Created on 17 May 2022, over 2 years ago

I'm working on a Drupal 9 website displaying custom table data and I need to provide CSV/XLS export links for it.
I've defined a view consuming the custom table data thanks to the Views Custom Table module. I've installed the Views Data Export module and configured a display to export data as CSV. This display is attached to the base display.
The CSV button is shown on the view, and when I'm logged in as admin, everything works fine. When I'm just an authenticated user, and I click on the button, the display attached to the CSV export is rendered and exported in CSV (so there is all the HTML in the file).

I think it is a permission issue: Export uses REST core module and this one is performing permission check on the entity (for example, user is able to access the entity). In my view, there is no entity because data comes from the View Custom Table module.

I'm not sure if there is a simple solution to find what is going wrong ?
Many thanks !

🐛 Bug report
Status

Active

Version

1.1

Component

Code

Created by

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇳India jahanaraS Bangalore

    I am facing a similar issue where the authenticated user is not able to download the CSV for commerce order details. Where as, while login as Admin same URL works to download the CSV file

    Any lead?

  • 🇳🇱Netherlands uberengineer

    We have experienced the same issue and have determined that Drupal configuration exports the $store_in_public_file_directory value as an integer however the export file is checked as a Boolean
    Patch checks the value against the boolean cast and correctly sets the public file directory and not private

  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 8.0 & MySQL 5.7
    last update over 1 year ago
    Patch Failed to Apply
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 5.7
    last update over 1 year ago
    Patch Failed to Apply
  • Open in Jenkins → Open on Drupal.org →
    Core: 9.5.x + Environment: PHP 7.4 & MySQL 5.7
    last update over 1 year ago
    Patch Failed to Apply
  • Status changed to Closed: works as designed about 1 month ago
  • 🇬🇧United Kingdom steven jones

    @Aurel60 hmm...I'm not keen that Views Data Export skips access checks by default, but the views UI does give you the option to do this for specific views if you really need to do so, but it would be better to get the access checks brought in by your Views Custom Table module sorted instead. Likewise @jahanaras with Drupal commerce, either allow access to the data you need, or don't :)

    @uberengineer I think that's another issue, but I can't see why it would be anything other than a boolean, but yeah, the strict type checking does seem a bit over the top.

Production build 0.71.5 2024