Webform CLI fails on import CiviCRM content

Created on 25 July 2023, over 1 year ago
Updated 8 April 2024, 8 months ago

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.

πŸ› Bug report
Status

Closed: won't fix

Version

6.2

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom chumkui

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

Comments & Activities

  • Issue created by @chumkui
  • πŸ‡¬πŸ‡§United Kingdom chumkui
  • Status changed to Postponed: needs info over 1 year ago
  • 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.

  • πŸ‡¬πŸ‡§United Kingdom chumkui

    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. The Drupal permission required to be set is:
    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.

  • Status changed to Closed: won't fix 8 months ago
  • πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY

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

Production build 0.71.5 2024