Run drush imports as user=1

Created on 6 May 2020, over 4 years ago
Updated 31 October 2023, about 1 year ago

Problem/Motivation

If someone wants to turn on entity validation for a migration, then you need to run the drush command as the root user. Otherwise simple things like filter format allowed values list will fail validation because you only give "Full HTML" to admins and "Restricted HTML" and/or Plain Text to anonymous users. By default, Drush runs as anonymous. Let's fix this.

Proposed resolution

This could lead to some possible problems, if someone was relying on the fact that migrations run as anonymous. So let's see if others feel this needs a way to toggle this automatic feature off.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

📌 Task
Status

RTBC

Version

5.0

Component

Code

Created by

heddn Nicaragua

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇹Italy robertom

    Reroll patch.

  • 🇺🇦Ukraine osab Germany, Baden-Württemberg; Ukraine, Kharkiv

    #12 works fine for me also, D10.1.5 php8.1. It fixed the error 'User %user not allowed to go from state %sid1 to %sid2' from workflow module, as it made migrate as anonymous.

  • 🇬🇧United Kingdom joachim

    > @Wim Leers, it is on text filters/formats. Full HTML is secured to only admin users. But drush runs everything as anonymous. And my content has a very common thing called a body field and entity validation running as anonymous fails validation. It isn't an issue running from migrate_drupal_ui, as it requires you to run the upgrade as user=1.

    Furthermore, with entity types that don't have an owner such as block_content, EntityContentBase::validateEntity() won't do any account switching.

Production build 0.71.5 2024