NAME
Ado::Command::adduser - adduser command
SYNOPSIS
USAGE
# On the command line
# Minimal required options to add a user
ado adduser --login_name USERNAME --email user\@example.com \
--first_name John --last_name Smith
# Add a user to an additional group
ado adduser --login_name USERNAME --ingroup GROUPNAME
# Change password / disable a user
ado adduser --login_name USERNAME --login_password N3W$36RE7P1$5W
# Disable a user
ado adduser --login_name USERNAME --disabled
# Programatically
use Ado::Command::adduser;
Ado::Command::adduser->run('--login_name'=>'test1',...);
DESCRIPTION
Ado::Command::adduser adds a user to an Ado application. It is a facade for Ado::Model::Users. This is a core Ado command, that means it is always available and its code a good example for learning to build new Ado commands, you're welcome to fork it.
ATTRIBUTES
Ado::Command::adduser inherits all attributes from Ado::Command and implements the following new ones.
args
$self->args(login_name=>'peter','ingroup'=>'facebook');
my $args = $self->args;
Default arguments for creating a user.
description
my $description = $a->description;
$a = $a->description('Foo!');
Short description of this command, used for the command list.
usage
my $usage = $a->usage;
$a = $a->usage('Foo!');
Usage information for this command, used for the help screen.
OPTIONS
On the commandline ado adduser
accepts the following options:
'u|login_name=s' #username (mandatory)
'p|login_password=s' #the user password (optional, random is generated)
'e|email=s' #user email (mandatory)
'g|ingroup=s' #existing users can be added to other groups too
'd|disabled:i' #is user disabled? (1 by default)
'f|first_name=s' #user's first name (mandatory)
'l|last_name=s' #user's last name (mandatory)
'start_date=s' #format: %Y-%m-%d (optional, today by default)
METHODS
Ado::Command::adduser inherits all methods from Ado::Command and implements the following new ones.
init
Calls the default parent "init" in Ado::Command and parses the arguments passed on the command-line. Returns true on success. Croaks with "usage" message on failure.
adduser
The default and only action this command implements. Makes logical checks for existing user and group and calls "adduser" in Ado::Model::Users and "add_to_group" in Ado::Model::Users depending on parsed arguments. See "run" in Ado::Command.
SEE ALSO
Ado::Model::Users, Ado::Command Ado::Manual, Mojolicious::Command, Mojolicious, Mojolicious::Guides.