user
Creates, updates, ensures or deletes a user account with its groups, password and fields.
A step of a YAML migration with type: user. The class expMigrationStepUser (kernel/classes/migration/steps/expmigrationstepuser.php) is registered in settings/migration.ini [StepSettings] StepTypeList[user].
Modes
mode: is one of create, update, ensure, delete; every step names one.
Keys
| Key | Type | Modes | Default | What it is |
|---|---|---|---|---|
login | string | create, ensure | the login of a new user; ensure finds the user by it | |
user | identifier (user) | update, delete | the user to update or delete: login, id or remote:<remote id> | |
email | string | create, update, ensure | the e-mail address of the account | |
password | string | create, update, ensure | the password, hashed as eZUser hashes it (ensure: only for a new user); use a placeholder, never the password in the file | |
password_hash | string | create, update, ensure | a password hash to store as it is (instead of password:) | |
password_hash_type | string | create, update, ensure | the type of password_hash: (md5_password, md5_user, md5_site, plaintext, password_hash ...) | |
secrets | map | create, update, ensure | login, email or password => the name of a secret (Setup > Secrets, or env:<variable>) the value is read from when the step runs, instead of login:, email: or password: | |
enabled | bool | create, update, ensure | whether the account can sign in (default for a new user: true) | |
groups | list | create, update, ensure | the nodes of the user groups the user is in (the first is its main location); update and ensure add the user to those it is not in | |
remove_groups | list | update | the nodes of user groups the user leaves (not the main one) | |
class | identifier (class) | create, ensure | "user" | the class of a new user (default: user) |
remote_id | string | create, ensure | the remote id of a new user's object | |
language | string | create, update, ensure | the language of fields: (default: the default language of content) | |
fields | map | create, update, ensure | attribute identifier => value (first_name, last_name ...); the account is set by login:, email: and password: | |
missing | string: fail, skip | update, delete | "fail" | what happens when the user is not there: fail (the default) or skip |
workflows | bool | create, update, ensure | false | true: the workflows of the operation's triggers run, as in the administration (default: they do not) |
notify | bool | create, update, ensure | false | true: the publish makes a notification event (default: published without notification) |
Besides these, every step takes the keys of the engine: type, mode, if, references, environments, engines and comment (the file format). A key of type identifier names a node, an object or another part of the installation by id, remote id, path or name (identifiers).
Values for references
references: { <name>: <value> } keeps a value of the step's result as ${ref.<name>} for the steps and migrations after it:
| Value | What it is |
|---|---|
object_id | the id of the user's object (the user id) |
node_id | the id of its main node |
remote_id | its remote id |
login | the login |
email | the e-mail address |
created | true when the step created the user |
changed | true when the step changed it (created, updated or deleted) |
Undoing
Some steps of this type undo themselves when their migration is rolled back without down: (the class says which); a migration with any other step of it needs down: or a rollback to its caption.
Caches it touches (cleared after the run): content, user_info_cache.
Example
- type: user
mode: ensure
login: editor
email: [email protected]
password: "${ref.editor_password}"
groups: [ "remote:news-editors" ]
fields: { first_name: News, last_name: Editor }
references: { editor: object_id }Related
Generated by ./console exp:help:examples from settings/migration.ini, kernel/classes/migration/steps/expmigrationstepuser.php. Do not edit this page: change the source and generate again (how). Free documentation: GFDL 1.3 or later.