Needs work
Project:
Migrate Tools
Version:
6.1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
6 May 2020 at 19:39 UTC
Updated:
31 Dec 2025 at 17:35 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
heddnComment #3
andypostDefault content module using the same approach
Comment #4
heddnI copied from default_content :smile:
Comment #5
wim leersInterestingly, I have not run into this problem. What is the concrete entity validation constraint that is failing without this?
Comment #6
heddn@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.
Comment #7
andrewmacpherson commentedSome other scenarios I've encountered...
It fails on entity reference for the ownership of the referenced entity.
Path alias migrations can fail validation too: "\[path_alias: 12842, revision: 1533\]: path.0.value=Either the path '/node/14' is invalid or you do not have access to it."
FWIW, I'm happily using the patch here on a personal project. It fixes both the scenarios I've mentioned here.
I'm aware of the related core patch, but it's rolled against 9.1.x and I'm not ready for D9 yet.
I assume the file entity reference scenario could also be a problem for migrating the imagefield on a D7 standard profile article, migrating to a D8 standard profile article.
Comment #8
heddnThe great Gitlab migration is upon us. Please post your comments to https://gitlab.com/drupalspoons/migrate_tools/-/issues/75 in the future.
Comment #9
joekersI'm not sure drupalspoons is still the place to post comments on this, it looks pretty quiet over there, but apologies if so.
The patch is working well for me. I also needed it for the text filter format and to handle a content moderation workflow error.
Comment #10
ludo.rI applied the patch provided here: https://www.drupal.org/project/migrate_tools/issues/3134245#comment-1360...
And it works.
Comment #11
phma commented#2 works for me when importing nodes with a default moderation state. Else I either have to disable content moderation or give workflow access to the anonymous user.
Comment #12
robertom commentedReroll patch.
Comment #13
osab commented#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.
Comment #14
joachim commented> @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.
Comment #15
heddnInstead of defaulting to user=1, let's make this a configurable for _which_ user we want to execute as. Similar to how drush used to work .i.e.
drush mim --uid=33 my_migration. My logic being that user=1 is no longer always a full admin user since https://www.drupal.org/node/2910500Comment #17
vasikeComment #20
vasikeCreated a MR with new uid option for import only using the account_switcher service.
I tested within a project doing Migrate Source CSV dependant migration imports, using ECA Models to control different entities data.
And it worked as expected.
Needs review ... for now ... to get some feedback.
Do we need also for other "commands"?
Note: For ECA models "alteration" this could also achieved, but currently the option is to have the user set for all models ...
Also it seems the issue was previously for an older version, so initially I created a "bad" branch
which seems I can't delete it
https://git.drupalcode.org/issue/migrate_tools-3134245/-/tree/3134245-ru...
Comment #21
vasikeComment #22
emanaton commentedReroll of patch for version 6.1.2.
Comment #23
heddnMR needs a rebase
Comment #24
heddnI like the idea here. This should help in certain situations. Needs a quick rebase. Ideally we'd add test coverage. I think that is possible.