exp:expusercreate
Create a user account through the content publish, as the administration does (its workflows and the approval of new accounts run): login, e-mail, names, groups, and a password from standard input, a generated one or the activation mail (a dry run unless --apply).
Script bin/php/expusercreate.php, code in kernel/private/classes/commands/expusercreate.php. Run it from the installation root, as the user the web server runs as:
./console exp:expusercreate --help
./console exp:user:create --help
php bin/php/expusercreate.php --helpHelp text
Create a user account
Creates the account as a content object of a user class in its first group and publishes it with
the content/publish operation, exactly as the administration does: its workflows run, so where
new accounts need approval the account waits until it is approved. The other groups are added as
locations. Choose one way to the password: --password-stdin (one line on standard input, never
on the command line), --generate-password (printed once) or --send-activation (the account starts
disabled and gets the activation mail). Without --apply nothing is created: the command lists what
it would do and which checks fail.
./console exp:user:create --login=jane [email protected] --first-name=Jane --last-name=Doe \
--group=Editors --generate-password --apply
printf '%s\n' "$PASSWORD" | ./console exp:user:create --login=ci-bot [email protected] --group=12 --password-stdin --apply
./console exp:user:create --login=member1 [email protected] --group=Members --send-activation --applyOptions
| Option | Value | Help |
|---|---|---|
--login | required | The login name (create: of the new account; edit: the new login name) |
--email | required | The e-mail address (create: of the new account; edit: the new address) |
--first-name | required | The first name (the attribute first_name of the user class) |
--last-name | required | The last name (the attribute last_name of the user class) |
--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) |
--class | required | The user class of the new account (default the class of [UserSettings] UserClassID) |
--password-stdin | Read the password from standard input (one line), never from the command line (create and reset-password: it must pass the password rules) | |
--generate-password | Generate a password that passes the password rules and print it once | |
--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) |
Read from the option definitions in the code (startup(), getOptions(), options() or ezcConsoleOption). Every script also takes the standard options of the script framework (--help, --siteaccess, --debug, --quiet, --allow-root-user ...).
Related
Generated by ./console exp:help:examples from bin/php/expusercreate.php, kernel/private/classes/commands/expusercreate.php. Do not edit this page: change the source and generate again (how). Free documentation: GFDL 1.3 or later.