Allow migrating CAS users from the cas_user table in D7 to the authmap table in D8.

Issue fork cas-3038662

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

semiaddict created an issue. See original summary.

semiaddict’s picture

StatusFileSize
new1.58 KB

Attached is a patch that adds a migration for D7.

semiaddict’s picture

Status: Active » Needs review
epersonae2’s picture

This worked for me!

Things I needed to edit, that maybe deserves some documentation:

Add migration group to match the rest of my migration: migration_group: migrate_drupal_7
Edit migration reference, again to match the rest of the migration: d7_user to upgrade_d7_user
(I also edited the label just so it would appear next to the user migration in any status listings)

[note that these are the defaults if you use the baseline d7 > d8 migration configuration files as a starting point]

this is what I ended up as my working migration, minus the uuid:

id: d7_cas_user
label: User (CAS Login)
migration_tags:
  - Drupal 7
migration_group: migrate_drupal_7
source:
  plugin: d7_cas_user
process:
  uid:
    -
      plugin: migration_lookup
      migration: upgrade_d7_user
      source: uid
    -
      plugin: skip_on_empty
      method: row
  provider:
    -
      plugin: default_value
      default_value: cas
  authname: cas_name
destination:
  plugin: authmap
migration_dependencies:
  required:
    - upgrade_d7_user
byronveale’s picture

StatusFileSize
new1.59 KB

The patch in #2 worked for me as well. I'm attaching a patch with a totally minor update, a "Content" tag.

Looking at the migration .yml file for the core user module, I see that migration id is "d7_user", so I left the required migration dependency alone. I also didn't include the migration group, as that seemed to be the established pattern for migration files in various core modules.

juampynr made their first commit to this issue’s fork.

juampynr’s picture

I created a merge request using #5 and made the following adjustments:

* Changed users to d7_user as the migration to lookup for.
* Reworded a field description.

https://git.drupalcode.org/project/cas/-/merge_requests/1/diffs

paramnida’s picture

StatusFileSize
new1.59 KB

Re-rolling the patch in #5 with juampynr's changes (for ease of use if referencing the patch via Composer).

paramnida’s picture

StatusFileSize
new1.59 KB

Oops. My re-roll didn't apply cleanly. This one hopefully should.

bkosborne’s picture

Status: Needs review » Fixed

The D7 CAS module allows multiple CAS usernames to be associated with a single local Drupal account. The D8+ CAS module does not allow this. This will be a problem for any sites that had multiple CAS names for whatever reason. I'm not sure what the best approach is for addressing that. It will throw a database exception when it tries to migrate the 2nd CAS name for the same user. So maybe the user just needs to be aware it's not supported and the extra names must be dropped.

I think it's likely rare there are sites with multiple names, but I really don't know.

In any case, I don't know that the migrate plugin can really resolve that sensibly, as the site owner needs to decide which ones to drop.

I'll merge this in as is.

  • bkosborne committed a7be3f8 on 2.x authored by paramnida
    Issue #3038662 by juampynr, paramnida, semiaddict, byronveale: Add...

  • bkosborne committed a7be3f8 on 8.x-1.x authored by paramnida
    Issue #3038662 by juampynr, paramnida, semiaddict, byronveale: Add...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.