Problem/Motivation

I am trying move data from D7 to D9 and have recreated a form in D9. The form contains several contacts, a case and an activity attached to that case.

Importing data via the UI works but causes timeouts with larger import files, so I used the webform CLI command.

Running Drush webform:import [myForm] [myCSV] give an error message:

source_contact_id is not a valid integer

See Webform import command line fails but import via UI is OK?

This does appear to be a permissions issue i.e. Drush running at an anonymous user. Newer versions of Drush cannot be run with an elevated user as they used to be able to (I am using 10.6.2). If on the Drupal permissions side I give the Anonymous user:

CiviCRM: all CiviCRM permissions and ACLs
Administer and use CiviCRM bypassing any other permission or ACL checks and enabling the creation of displays and forms that allow others to bypass checks. This permission should be given out with care

The import works as expected.

This would seem to be odd and certainly a limitation for this sort of function, given that the Webform CiviCRM integration is installed and functioning properly. From a security point of view, if someone has Drush access, you have bigger problems.

Proposed resolution

Webform import to use the Account Switcher to run as an elevated user for this type of use case.

Comments

chumkui created an issue. See original summary.

chumkui’s picture

Issue summary: View changes
cilefen’s picture

Status: Active » Postponed (maintainer needs more info)
Issue tags: +Needs steps to reproduce

This bug seems to require a lot of setup. Please update the issue summary with precise steps, starting with installing Drupal, to reproduce the bug, and include the YAML of a minimum example form.

chumkui’s picture

It does require a bit of setup as we have a CiviCRM installation with a fair few custom fields. I'll try to create a 'minimum' example of where it will fail. One of the issues is that the you cannot tell from the logs exactly what the issue is. Of the various things that happen on the import, which one exactly triggers the problem, my guess is access to a custom field. In the meantime, I've solved the pressing issue from the other direction, i.e. giving overly permissive permissions to the anonymous user for the duration of the import.

jrockowitz’s picture

Version: 6.1.5 » 6.2.x-dev
Status: Postponed (maintainer needs more info) » Closed (won't fix)

If there is workaround for CiviCRM, I am going to mark this as won't fix