exp:expuserimport
Available since Exponential 6.0.15 (in development, not in a release yet).
Summary
Import accounts from a CSV or JSON file, each created as exp:user:create creates it, with the activation mail or disabled; never a password from the file (a dry run that checks every row unless --apply)
Usage
./console exp:expuserimport [options] php bin/php/expuserimport.php [options] ./console exp:user:import [options]
Aliases
exp:user:import
Help
The output of ./console help exp:expuserimport (the script run with --help), without the standard options:
Usage: bin/php/expuserimport.php [OPTION]... [FILE] Import accounts Reads a CSV file (a header line with the columns login, email, first_name, last_name, groups) or a JSON file (an array of objects with the same keys); groups are node ids or names separated by |, and a row without groups goes to --group. Each account is created exactly as exp:user:create creates it. Choose --send-activation (every person gets the activation mail and sets a password with "Forgot password") or --disabled (the accounts start disabled; reset their passwords later). A file with a password column is refused: an import never takes passwords. A login that exists already is skipped; a login twice in the file is refused. Without --apply every row is checked and nothing is created. ./console exp:user:import members.csv --group=Members --send-activation ./console exp:user:import members.csv --group=Members --send-activation --apply ./console exp:user:import staff.json --disabled --apply --format=json Options: --type=VALUE The file type: csv (default) or json; import reads it from the file name when not given --group=VALUE... A user group by node id or name: list, export and bulk take only its members (below it, at any depth); create and import: the group of the new accounts (repeat for more, the first is the main group; default [UserSettings] DefaultUserPlacement) --send-activation Create the account disabled and send the activation mail; the person sets a password with "Forgot password" --disabled Create the account disabled (enable it later with exp:user:enable) --apply Make the change; without it the command only lists what it would change (a dry run) --dry-run The default, kept for scripts that pass it: list what would change, change nothing --as=VALUE Act as this user (login, e-mail or id; default the user of [UserSettings] UserCreatorID); the audit records it as who did it --format=VALUE text (default) or json (the machine output exp-user/1)
Options
| Option | Value | Description |
|---|---|---|
| --type | required | The file type: csv (default) or json; import reads it from the file name when not given |
| --group | required | A user group by node id or name: list, export and bulk take only its members (below it, at any depth); create and import: the group of the new accounts (repeat for more, the first is the main group; default [UserSettings] DefaultUserPlacement) |
| --send-activation | - | Create the account disabled and send the activation mail; the person sets a password with "Forgot password" |
| --disabled | - | Create the account disabled (enable it later with exp:user:enable) |
| --apply | - | Make the change; without it the command only lists what it would change (a dry run) |
| --dry-run | - | The default, kept for scripts that pass it: list what would change, change nothing |
| --as | required | Act as this user (login, e-mail or id; default the user of [UserSettings] UserCreatorID); the audit records it as who did it |
| --format | required | text (default) or json (the machine output exp-user/1) |
Arguments
[file]
Standard options
Every script also takes the standard options of the script framework: --help, --quiet, --siteaccess, --debug, --colors, --no-colors, --logfiles, --no-logfiles, --verbose and --allow-root-user.
Source
bin/php/expuserimport.php, kernel/private/classes/commands/expuserimport.php
See also
Generated example: exp:expuserimport
Added to the reference for Exponential 6.0.15.
Contributors
- Graham Brookins Updated
Comments
Add a comment