- Issue created by @rex.barkdoll
- π―π΅Japan ptmkenny
I am having the same issue. I will attempt to find the bad commit, but when I edit the mappings for Role, I can no longer select "id", only "UUID" or "User role weight".
- π―π΅Japan ptmkenny
In my exported config:
map: target_id: roles settings: - reference_by: id + reference_by: uuid
So it looks like the id reference got removed, but when? I also confirmed this behavior in the latest dev; it is no longer possible to reference roles by machine_name, but that is the most convenient way to do so.
- last update
7 months ago 717 pass - Status changed to Needs review
7 months ago 3:17pm 10 May 2024 - π―π΅Japan ptmkenny
Ok, I found the cause of the bug. ConfigEntityReference.php is not checking for id if there are mapping definitions, only UUID.
I think everything in Drupal has an id and a UUID, so I modified the code to assume everything does and simplify the logic. But, I don't know if this is actually a safe assumption. Let's see what the tests say, and please review.
- π³π±Netherlands megachriz
The issue is actually that Drupal 10 apparently added some new data types for config schema. Data types 'machine_name' and 'required_label' are new.
Config schema for user role in Drupal 9:
user.role.*: type: config_entity label: 'User role settings' mapping: id: type: string label: 'ID' label: type: label label: 'Label' weight: type: integer label: 'User role weight' is_admin: type: boolean label: 'User is admin' permissions: type: sequence label: 'Permissions' orderby: value sequence: type: string label: 'Permission'
And in Drupal 10:
user.role.*: type: config_entity label: 'User role settings' mapping: id: type: machine_name label: 'ID' label: type: required_label label: 'Label' weight: type: integer label: 'User role weight' is_admin: type: boolean label: 'User is admin' permissions: type: sequence label: 'Permissions' orderby: value sequence: type: string label: 'Permission'
So changes in Drupal core broke this in Feeds.
- π³π±Netherlands megachriz
From https://www.drupal.org/node/3349638: β
Note: There's no disruption for config schemas switching from type: label to type: required_label, because config schema validation is not yet being used.
Hm, that's not true for Feeds!
Besides machine_name, other newly introduced types don't seem to be significant for Feeds: https://www.drupal.org/list-changes/drupal/published?keywords_descriptio... β
- last update
6 months ago 720 pass - last update
6 months ago 720 pass - π³π±Netherlands megachriz
@ptmkenny
A config entity doesn't always have an 'id' property, but it does have an 'uuid' property:config_entity: type: mapping mapping: uuid: type: uuid label: 'UUID' langcode: type: langcode status: type: boolean label: 'Status' dependencies: type: config_dependencies label: 'Dependencies' third_party_settings: type: sequence label: 'Third party settings' sequence: type: '[%parent.%parent.%type].third_party.[%key]' _core: type: _core_config_info
So I reverted your changes in the MR.
- Status changed to RTBC
6 months ago 4:52pm 20 May 2024 - π―π΅Japan ptmkenny
Thank you so much for the explanation and better solution.
I have a site that can be initialized and all of the content is imported from feeds, so I tested the updated MR there. All the roles were imported correctly, so marking RTBC.
- last update
6 months ago 720 pass -
MegaChriz β
committed 8b154da4 on 8.x-3.x authored by
ptmkenny β
Issue #3441669 by MegaChriz, ptmkenny: Role is missing on user import
-
MegaChriz β
committed 8b154da4 on 8.x-3.x authored by
ptmkenny β
- Status changed to Fixed
6 months ago 6:17pm 20 May 2024 Automatically closed - issue fixed for 2 weeks with no activity.
- πΊπΈUnited States rraney
Hello - I think I have the same issue. I updated the module. I tried using the machine name and mapping to ID. In Devel, the id is the same as the machine name. That didn't work. I am now going to try mapping the UUID to the UUID. Is that the proposed solution once the module is updated?
- π³π±Netherlands megachriz
@rraney
When mapping to user roles, it makes the most sense to reference roles by ID or by label. But you could use UUID as well. When on Drupal 10, you need Feeds 8.x-2.0-beta5 or later to configure the role target in the UI.