Problem/Motivation

If a user does not have access to perform a bulk operation on any of the selected entities and the selected action requires a redirect to a confirmation form, the redirect is still performed, even though it does not make sense anyway and also results in an Access denied page being shown to the user.

Drupal's access denied page with an error message about not being allowed to peform the Delete content action.

Proposed resolution

Do not perform the redirect if the user does not have access to perform the bulk operation on any of the entities. We already show a proper error message for the non-allowed entities anyway, so it should be clear what is happening.

The if ($count) check in \Drupal\views\Plugin\views\field\BulkForm::viewsFormSubmit() can simply be moved before the check for the confirm route to solve this issue.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tstoeckler created an issue. See original summary.

Lendude’s picture

Status: Active » Needs review
FileSize
1.35 KB
2.73 KB

Nice find.

Test and proposed fix, let's see if this breaks anything else...

Lendude’s picture

quick cleanup

The last submitted patch, 2: 3018148-2-TEST_ONLY.patch, failed testing. View results

rgpublic’s picture

Patch #3 works great for me under 8.7.10. Thanks!

Lendude’s picture

Version: 8.6.x-dev » 8.8.x-dev
FileSize
2.17 KB
2.71 KB

Fixed a minor typo.

@rgpublic feel free to set to RTBC if you feel this is ready

rgpublic’s picture

@Lendude: Well for me it works without any problems (tested this by manually trying to delete files where some or all of them are inaccessible). In addition, I see you have added a dedicated test. Wonderful! But as this is quite a low-level change on a core-component, it might perhaps be useful to wait for another confirmation. I feel a bit reluctant to declare myself alone as the "community" (the C in RTBC) ;-) So.... Hello, you other 3 followers lurking in the dark... Could you verify/check if this is also working for you?

Status: Needs review » Needs work

The last submitted patch, 6: 3018148-6.patch, failed testing. View results

Lendude’s picture

Status: Needs work » Needs review
Issue tags: +subs
FileSize
1001 bytes
2.72 KB

Fixed the test, now that it's using stark and not classy anymore we can't use the class to find the views form.

@rgpublic you are the "C", never doubt it. You, along with the patch roller, and the core committer, means 3 pairs of eyes will have seen this once it gets committed, and that (plus automated test coverage) is sufficient. If it is something significantly hard it can be tagged for 'needs subsystem maintainer review', but this isn't (and I happen to be a Views subsystem maintainer, so you got that anyway :).

Would it be nice to always get more eyes on it? Sure, but it's not required, your eyes and your great manual testing of this as described in #7 is exactly what was missing for this to be RTBC'd.

rgpublic’s picture

Status: Needs review » Reviewed & tested by the community

Okay, great! RTBC'ing per #9. Let's see what happens :-)

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 9: 3018148-9.patch, failed testing. View results

Lendude’s picture

Status: Needs work » Reviewed & tested by the community
Issue tags: -subs

Unrelated fail, back to RTBC

alexpott’s picture

Status: Reviewed & tested by the community » Patch (to be ported)

Committed and pushed 78f8ee05bb to 9.0.x and 7e844b90b6 to 8.9.x. Thanks!

Going to ask other committers about backporting to 8.8.x as I feel this is a risk free bugfix.

  • alexpott committed 78f8ee0 on 9.0.x
    Issue #3018148 by Lendude, tstoeckler: Views bulk forms perform...

  • alexpott committed 7e844b9 on 8.9.x
    Issue #3018148 by Lendude, tstoeckler: Views bulk forms perform...
alexpott’s picture

Status: Patch (to be ported) » Fixed

@catch +1'd the backport

  • alexpott committed 890e0aa on 8.8.x
    Issue #3018148 by Lendude, tstoeckler: Views bulk forms perform...

Status: Fixed » Closed (fixed)

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