Implement create permission command
This commit is contained in:
@ -22,7 +22,7 @@ class CreateUserCommand extends Command
|
||||
|
||||
public function configure(): void
|
||||
{
|
||||
$this->addArgument('name', InputArgument::OPTIONAL, 'User name');
|
||||
$this->addArgument('user', InputArgument::OPTIONAL, 'User name');
|
||||
$this->addArgument('password', InputArgument::OPTIONAL, 'User password');
|
||||
$this->addArgument('host', InputArgument::OPTIONAL, 'User host');
|
||||
}
|
||||
@ -31,12 +31,12 @@ class CreateUserCommand extends Command
|
||||
{
|
||||
$question = $this->getHelper('question');
|
||||
|
||||
$name = $input->getArgument('name');
|
||||
$user = $input->getArgument('user');
|
||||
$password = $input->getArgument('password');
|
||||
$host = $input->getArgument('host');
|
||||
|
||||
if (!$name) {
|
||||
$name = $question->ask($input, $output, new Question('User name: '));
|
||||
if (!$user) {
|
||||
$user = $question->ask($input, $output, new Question('User name: '));
|
||||
}
|
||||
if (!$password) {
|
||||
$passwordQuestion = new Question('User password: ');
|
||||
@ -44,9 +44,9 @@ class CreateUserCommand extends Command
|
||||
$password = $question->ask($input, $output, $passwordQuestion);
|
||||
}
|
||||
|
||||
$this->db->createUser($name, $password, $host);
|
||||
$this->db->createUser($user, $password, $host);
|
||||
|
||||
$output->writeln(sprintf('User "%s" successfully created', $name));
|
||||
$output->writeln(sprintf('User "%s" successfully created', $user));
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
|
Reference in New Issue
Block a user