id: d7_users
label: User accounts
migration_group: popsu
audit: true
migration_tags:
  - Drupal 7
  - Content
  - Popsu

source:
  plugin: d7_users
  batch_size: 1000

destination:
  plugin: entity:user

process:
  name: name
  pass: pass
  mail:
    -
      plugin: skip_on_value
      equals: true
      source: mail
      method: row
      value:
        - "manager-popsu@renaud-cuny.com"
        # - "editeur-popsu@renaud-cuny.com"
    -
      plugin: default_value
      source: mail
      default_value: null

  created: created
  access: access
  login: login
  status: status
  timezone: timezone
  # langcode:
  #   plugin: user_langcode
  #   source: entity_language
  #   fallback_to_site_default: false
  # preferred_langcode:
  #   plugin: user_langcode
  #   source: language
  #   fallback_to_site_default: true
  # preferred_admin_langcode:
  #   plugin: user_langcode
  #   source: language
  #   fallback_to_site_default: true
  init: init
  roles:
    -
      plugin: skip_on_value
      equals: true
      source: roles
      method: row
      value:
        - 5
    -
      plugin: static_map
      source: roles
      default_value: 2
      map:
        1: "anonymous"
        2: "authenticated"
        3: "admin"
        4: "editeur"
        5: "root"

migration_dependencies:
  required:
    - d7_allpublicfiles
