Problem/Motivation

The CSV icon/link appear on the parent view and assume that the parent view and attached view have the same access conditions. If the parent view and the export view have different access rules this can lead to the CSV button being rendered and then leading to a 403 once clicked on.

Proposed resolution

Run an access check on the export display prior to rendering the CSV icon/link on the parent view.

Remaining tasks

Tests

User interface changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Juterpillar created an issue. See original summary.

Juterpillar’s picture

I've attached a patch that implements an access check before rendering the CSV button/link.

Mikael Berger’s picture

Mikael Berger’s picture

The patch seems to work, I have implemented it in a site built with Drupal 8.3.7 and all is good.

thtas’s picture

A different version of the patch attached with the same logic, just less lines of code changed.

thtas’s picture

FileSize
601 bytes

oops - fixed patch

kevin.dutra’s picture

Status: Active » Needs review

Don't forget to mark it as needing review once you add a patch, otherwise people won't realize that there was progress made. :)

The last submitted patch, 2: views_data_export_icon_access_2851939.patch, failed testing. View results

kevin.dutra’s picture

Status: Needs review » Needs work

This change seems good to me and I've tested it out. The only thing that would be great to have is an automated test to ensure that a regression doesn't pop up.

jhedstrom’s picture

Interesting. This also happens with the core Rss and Opml style plugins, so an ideal fix would be in core (which just seems like not calling the attachTo() method would suffice).

Can you add a core bug, then a @todo comment to this patch noting that the code can be removed once the core bug is fixed (and also a link to the bug in the code comment).

kevin.dutra’s picture

matslats’s picture

The latest 1.0 release of June 20 seems not to have included the patch #6 and prevented it from applying...
Has the bug been fixed in another way?

matslats’s picture

Status: Needs work » Fixed

Yep I think the bug was fixed another way

Status: Fixed » Closed (fixed)

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