Release 2.5.0 (#4454)
- added command to list users - corrected wrong german translation - work contract validations - prevent error with missing params - use collapsible, minor UI improvement - added classes to target menu buttons in custom rules - disable webpack notifier, incompatible with mac arm - use explicit menu service to generate menu - bump to fontawesome 6 and replace restart icon - change repeat icon for recent activities - moved user bookmarks (favorites) to top nav - fix totp seconds window (leeway) - new migration to fix remaining user preferences with dots in name - remove duplicate named column in user screen - unify and added translations - added missing filter and tags to InvoiceSecurity
This commit is contained in:
49
src/Command/ListUserCommand.php
Normal file
49
src/Command/ListUserCommand.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of the Kimai time-tracking app.
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace App\Command;
|
||||
|
||||
use App\Repository\UserRepository;
|
||||
use Symfony\Component\Console\Attribute\AsCommand;
|
||||
use Symfony\Component\Console\Command\Command;
|
||||
use Symfony\Component\Console\Input\InputInterface;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
#[AsCommand(name: 'kimai:user:list', description: 'List all users')]
|
||||
final class ListUserCommand extends Command
|
||||
{
|
||||
public function __construct(private UserRepository $repository)
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||
{
|
||||
$output = new SymfonyStyle($input, $output);
|
||||
$users = $this->repository->findAll();
|
||||
|
||||
$data = [];
|
||||
foreach ($users as $user) {
|
||||
$data[] = [
|
||||
$user->getUserIdentifier(),
|
||||
$user->getEmail(),
|
||||
implode(', ', $user->getRoles()),
|
||||
$user->isEnabled() ? 'X' : '',
|
||||
$user->getPasswordRequestedAt()?->format('Y-m-d H:i:s')
|
||||
];
|
||||
}
|
||||
|
||||
$header = ['Username', 'Email', 'Roles', 'Active', 'PW Reset'];
|
||||
|
||||
$output->table($header, $data);
|
||||
|
||||
return Command::SUCCESS;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user