mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-31 12:03:48 +00:00
Apply rector rules: symfony up to 54
This commit is contained in:
@@ -27,12 +27,12 @@ use Symfony\Component\Console\Input\InputOption;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Question\ChoiceQuestion;
|
||||
use Symfony\Component\Console\Question\ConfirmationQuestion;
|
||||
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
|
||||
use Symfony\Component\Validator\ConstraintViolationListInterface;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
class ChillImportUsersCommand extends Command
|
||||
{
|
||||
protected static $defaultDescription = 'Import users from csv file';
|
||||
/**
|
||||
* Centers and aliases.
|
||||
*
|
||||
@@ -55,7 +55,7 @@ class ChillImportUsersCommand extends Command
|
||||
public function __construct(
|
||||
protected EntityManagerInterface $em,
|
||||
protected LoggerInterface $logger,
|
||||
protected UserPasswordEncoderInterface $passwordEncoder,
|
||||
protected \Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface $passwordEncoder,
|
||||
protected ValidatorInterface $validator,
|
||||
protected UserRepository $userRepository
|
||||
) {
|
||||
@@ -86,7 +86,6 @@ class ChillImportUsersCommand extends Command
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
->setDescription('Import users from csv file')
|
||||
->setHelp("Import users from a csv file. Users are added to centers contained in the file. Headers are used to detect columns. Adding to multiple centers can be done by using a `grouping centers` file, which will group multiple centers into a signle alias, used in 'centers' column.")
|
||||
->addArgument('csvfile', InputArgument::REQUIRED, 'Path to the csv file. Columns are: `username`, `email`, `center` (can contain alias), `permission group`')
|
||||
->addOption('grouping-centers', null, InputOption::VALUE_OPTIONAL, 'Path to a csv file to aggregate multiple centers into a single alias')
|
||||
@@ -130,7 +129,7 @@ class ChillImportUsersCommand extends Command
|
||||
->setEmail(\trim((string) $data['email']))
|
||||
->setUsername(\trim((string) $data['username']))
|
||||
->setEnabled(true)
|
||||
->setPassword($this->passwordEncoder->encodePassword(
|
||||
->setPassword($this->passwordEncoder->hashPassword(
|
||||
$user,
|
||||
\bin2hex(\random_bytes(32))
|
||||
));
|
||||
@@ -207,7 +206,7 @@ class ChillImportUsersCommand extends Command
|
||||
throw $e;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user