Problem/Motivation

In #2887450: Re-add Drush commands Drush commands were added back, including a most welcome option to switch the user for executing the View. Unfortunately, the switching does not work correctly if there is a batch that needs processing (at least in my specific situation).

Steps to reproduce

  • Have a VDE View that only works for a privileged user
  • Make sure the View uses batch processing
  • Export the View using the drush command
  • Notice that the export does not work correctly due to the missing user permissions

Proposed resolution

Pass the current user ID when building the batch, and check whether it is required to switch to a different user when processing the batch.

Remaining tasks

  • Create MR
  • Debug tests
  • Review
  • Merge

User interface changes

None.

API changes

None.

Data model changes

None.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

eelkeblok created an issue. See original summary.

steven jones’s picture

Oh, super interesting! Because I tested this, and it totally worked fine and the account was switched correctly when doing a batched export.
I was surprised by this tbh, and didn't think too much about it, though I can imagine that yeah, it doesn't work in all cases!

What version of Drush are you using? Maybe that's important somehow?

eelkeblok’s picture

Status: Active » Needs review
eelkeblok’s picture

The project is on Drush 13. I did find mention of a global -u option to set the user ID and the batch processing in Drush is actually trying to set it somewhere, but apparently this was removed in Drush 9, so that can hardly be a factor. Something is still off, though, since tests are failing.

eelkeblok’s picture

Issue summary: View changes
eelkeblok’s picture

Issue summary: View changes
eelkeblok’s picture

Status: Needs review » Needs work
steven jones’s picture

Status: Needs work » Needs review

I think I've sorted it by trial and error.

steven jones’s picture

saahbaa’s picture

I also have this issue but the commit 5ac7c72c7f77bf4465d28b65c26a4723f9f43f8f not working. can you please let me know how can I make it work?

saahbaa’s picture

I just learned that we can set the user 1 (admin) by "--uid 1"

steven jones’s picture

Related issues: +#3552653: Release 8.x-1.7

steven jones’s picture

Status: Needs review » Fixed

@eelkeblok thanks for spotting the issue and the code to fix it.

Now that this issue is closed, please review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, please credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

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