Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
4be14fe
Update composer.json
nimleaf Jan 20, 2022
a90233c
Update composer.json
nimleaf Jan 20, 2022
50e9177
Update Mailer.php
nimleaf Jan 22, 2022
3efddc0
Update services.yml
nimleaf Jan 23, 2022
352bc8b
Update SecurityPass.php
nimleaf Jan 23, 2022
dce18a5
Update services.yml
nimleaf Mar 4, 2022
a29d335
twig
nimleaf Mar 17, 2022
7322528
twig
nimleaf Apr 13, 2022
c5904a8
twig
nimleaf Apr 13, 2022
aa95413
types
nimleaf Apr 13, 2022
068b3d6
types
nimleaf Apr 13, 2022
de71271
mailer
nimleaf May 9, 2022
44569ba
mailer
nimleaf May 9, 2022
ec3203e
mailer
nimleaf May 10, 2022
4edee38
mailer
nimleaf May 10, 2022
7a6e201
mailer
nimleaf May 10, 2022
73425c9
mailer
nimleaf May 10, 2022
02daf67
user
nimleaf May 17, 2022
9d4628f
mailer
nimleaf May 18, 2022
0f5003d
twig
nimleaf May 31, 2022
7a2a5c3
User
nimleaf May 31, 2022
062be16
update
nimleaf Jul 27, 2022
1474ddc
update
nimleaf Aug 1, 2022
46f6e94
update
nimleaf Aug 3, 2022
4073eb0
Merge branch 'php8' of https://github.com/nimleaf/user-bundle into php8
nimleaf Aug 3, 2022
7d3ac7f
UPDATE
nimleaf Oct 10, 2022
73e5d5a
update
nimleaf Oct 16, 2022
360dd9c
EDUZONEWEB-161
nimleaf Oct 23, 2022
b17441b
EDUZONEWEB-161
nimleaf Oct 30, 2022
e9debed
update composer
nimleaf Nov 28, 2022
d609a2e
update depracated
nimleaf Nov 28, 2022
3dd218e
Reverted file permissions
stepankoci Apr 25, 2023
249f712
Fixed funkcionality and tests
stepankoci Apr 27, 2023
7ce7a09
base layout name fix
stepankoci Apr 27, 2023
0a5784e
Upgrade 6 file added
stepankoci Apr 27, 2023
f063954
Fixed view bundle version
stepankoci Apr 27, 2023
13a3278
Updated lock
stepankoci Apr 27, 2023
92d657f
Github actions PHP version fix
stepankoci Apr 27, 2023
0cd056a
Dependency fixes
stepankoci Apr 27, 2023
4934a08
PHPCS fixer
stepankoci Apr 27, 2023
4608bc8
Removed AnnotationRegistry from bootstrap
stepankoci Apr 27, 2023
62aa365
Removed phpmd
stepankoci Apr 27, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
- uses: actions/checkout@v2
- uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
php-version: '8.1'
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
/nbproject/
.DS_Store
Thumbs.db
/.php_cs.cache
/.php-cs-fixer.cache
/.phpunit.result.cache
Tests/Fixtures/TestProject/bower.json
Tests/Fixtures/TestProject/.bowerrc
Tests/Fixtures/TestProject/web/bundles
Expand Down
22 changes: 9 additions & 13 deletions .php_cs.dist → .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

return PhpCsFixer\Config::create()
return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
Expand All @@ -11,15 +11,14 @@
'combine_consecutive_unsets' => true,
'concat_space' => ['spacing' => 'one'],
'declare_strict_types' => true,
'dir_constant' => true,
'ereg_to_preg' => true,
'heredoc_to_nowdoc' => true,
'include' => true,
'lowercase_cast' => true,
'magic_constant_casing' => true,
'modernize_types_casting' => true,
'native_function_casing' => true,
'native_function_invocation' => true,
'native_function_invocation' => ['strict' => false],
'new_with_braces' => true,
'no_alias_functions' => true,
'no_blank_lines_after_class_opening' => true,
Expand All @@ -28,17 +27,16 @@
'no_empty_comment' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_consecutive_blank_lines' => true,
'no_extra_blank_lines' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_mixed_echo_print' => true,
'no_multiline_whitespace_around_double_arrow' => true,
'no_multiline_whitespace_before_semicolons' => true,
'multiline_whitespace_before_semicolons' => false,
'no_php4_constructor' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_spaces_around_offset' => true,
'no_trailing_comma_in_list_call' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_trailing_comma_in_singleline' => true,
'no_unneeded_control_parentheses' => true,
'no_unneeded_curly_braces' => true,
'no_unused_imports' => true,
Expand All @@ -64,7 +62,7 @@
'phpdoc_to_comment' => true,
'phpdoc_types' => true,
'phpdoc_var_without_name' => true,
'psr4' => true,
'psr_autoloading' => true,
'self_accessor' => true,
'semicolon_after_instruction' => true,
'short_scalar_cast' => true,
Expand All @@ -74,18 +72,16 @@
'strict_comparison' => true,
'strict_param' => true,
'ternary_operator_spaces' => true,
'trailing_comma_in_multiline_array' => true,
'trailing_comma_in_multiline' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'void_return' => true,
'whitespace_after_comma_in_array' => true,
])
->setFinder(
PhpCsFixer\Finder::create()
->exclude([
'vendor',
'Tests/Fixtures/TestProject/var',
'tests/Fixtures/TestProject/var',
])
->in(__DIR__)
)
;
);
2 changes: 0 additions & 2 deletions Command/CommandUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ class CommandUtil
/**
* Ensure that PHPExcel is available.
*
* @param OutputInterface $output
*
* @throws \RuntimeException
*/
public static function checkPhpExcel(OutputInterface $output): void
Expand Down
26 changes: 3 additions & 23 deletions Command/RoleDocumentCreateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,17 +77,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}

/**
* Get default roles.
*
* @param string|null $userName
* @param string|null $groupName
* @param bool|null $defaultState
*
* @throws \LogicException
*
* @return array|bool
*/
private function getDefaultRoles($userName, $groupName, $defaultState)
private function getDefaultRoles(?string $userName, ?string $groupName, ?bool $defaultState): array|bool
{
if ($userName xor $groupName) {
if (null !== $defaultState) {
Expand All @@ -105,15 +97,9 @@ private function getDefaultRoles($userName, $groupName, $defaultState)
}

/**
* Get user roles.
*
* @param string $userName
*
* @throws \RuntimeException
*
* @return array
*/
private function getUserRoles($userName)
private function getUserRoles(string $userName): array
{
$user = $this->userManager->findUserBy(['username' => $userName]);
if (!$user) {
Expand All @@ -124,15 +110,9 @@ private function getUserRoles($userName)
}

/**
* Get group roles.
*
* @param string $groupName
*
* @throws \RuntimeException
*
* @return array
*/
private function getGroupRoles($groupName)
private function getGroupRoles(string $groupName): array
{
$group = $this->groupManager->findGroupBy(['name' => $groupName]);
if (!$group) {
Expand Down
28 changes: 4 additions & 24 deletions Command/RoleDocumentImportCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,13 @@
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

/**
* Role document import command.
*
* @author Pavel Batecko <pavel.batecko@imatic.cz>
*/
class RoleDocumentImportCommand extends Command
{
private UserManager $userManager;
private GroupManager $groupManager;

public function __construct(
UserManager $userManager,
GroupManager $groupManager
private UserManager $userManager,
private GroupManager $groupManager
) {
parent::__construct();
$this->userManager = $userManager;
$this->groupManager = $groupManager;
}

/**
Expand Down Expand Up @@ -90,14 +80,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}

/**
* Apply roles to user.
*
* @param string $userName
* @param array $roles
*
* @throws \RuntimeException
*/
private function applyRolesToUser($userName, array $roles): void
private function applyRolesToUser(string $userName, array $roles): void
{
$user = $this->userManager->findUserBy(['username' => $userName]);
if (!$user) {
Expand All @@ -109,14 +94,9 @@ private function applyRolesToUser($userName, array $roles): void
}

/**
* Apply roles to group.
*
* @param string $groupName
* @param array $roles
*
* @throws \RuntimeException
*/
private function applyRolesToGroup($groupName, array $roles): void
private function applyRolesToGroup(string $groupName, array $roles): void
{
$group = $this->groupManager->findGroupBy(['name' => $groupName]);
if (!$group) {
Expand Down
6 changes: 3 additions & 3 deletions Controller/ChangePasswordController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Symfony\Component\Routing\Annotation\Route;

/**
* @Route("/profile", name="fos_user_")
* @Route("/profile", name="user_")
*/
class ChangePasswordController extends AbstractController
{
Expand All @@ -24,12 +24,12 @@ public function changePasswordAction(Request $request, UserManager $userManager)
return $this->createAccessDeniedException();
}

$form = $this->createForm(ChangePasswordType::class, $user);
$form = $this->createForm(ChangePasswordType::class, $user, ['data_class' => $user::class]);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$userManager->updateUser($user);

return new RedirectResponse($this->generateUrl('fos_user_profile_show'));
return new RedirectResponse($this->generateUrl('user_profile_show'));
}

return $this->render('@ImaticUser/ChangePassword/change_password.html.twig', [
Expand Down
30 changes: 18 additions & 12 deletions Controller/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;

/**
* @Route("/profile", name="fos_user_profile_")
*/
#[Route(
path: '/profile',
name: 'user_profile_',
)]
class ProfileController extends AbstractController
{
/**
* @Route("/", methods={"GET"}, name="show")
*/
#[Route(
path: '/',
methods: ['GET'],
name: 'show',
)]
public function showAction()
{
$user = $this->getUser();
Expand All @@ -29,22 +32,25 @@ public function showAction()
]);
}

/**
* @Route("/edit", methods={"GET", "POST"}, name="edit")
*/
public function editAction(Request $request, UserManager $userManager)
#[Route(
path: '/edit',
methods: ['GET', 'POST'],
name: 'edit',
)]
public function editAction(Request $request, UserManager $userManager): \Symfony\Component\HttpFoundation\Response|RedirectResponse
{
$user = $this->getUser();
if (!$user instanceof UserInterface) {
$this->createAccessDeniedException();
}

$form = $this->createForm(ProfileType::class, $user);
\assert($user instanceof UserInterface);
$form = $this->createForm(ProfileType::class, $user, ['data_class' => $user::class]);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$userManager->updateUser($user);

return new RedirectResponse($this->generateUrl('fos_user_profile_show'));
return new RedirectResponse($this->generateUrl('user_profile_show'));
}

return $this->render('@ImaticUser/Profile/edit.html.twig', [
Expand Down
14 changes: 7 additions & 7 deletions Controller/ResettingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use Symfony\Component\Routing\Annotation\Route;

/**
* @Route("/resetting", name="fos_user_resetting_")
* @Route("/resetting", name="user_resetting_")
*/
class ResettingController extends AbstractController
{
Expand Down Expand Up @@ -41,7 +41,7 @@ public function sendEmailAction(Request $request, UserManager $userManager, Mail

if (null !== $user && !$user->isPasswordRequestNonExpired($this->retryTtl)) {
if (!$user->isAccountNonLocked()) {
return new RedirectResponse($this->generateUrl('fos_user_resetting_request'));
return new RedirectResponse($this->generateUrl('user_resetting_request'));
}

if (null === $user->getConfirmationToken()) {
Expand All @@ -53,7 +53,7 @@ public function sendEmailAction(Request $request, UserManager $userManager, Mail
$userManager->updateUser($user);
}

return new RedirectResponse($this->generateUrl('fos_user_resetting_check_email', ['username' => $username]));
return new RedirectResponse($this->generateUrl('user_resetting_check_email', ['username' => $username]));
}

/**
Expand All @@ -64,7 +64,7 @@ public function checkEmailAction(Request $request)
$username = $request->query->get('username');

if (empty($username)) {
return new RedirectResponse($this->generateUrl('fos_user_resetting_request'));
return new RedirectResponse($this->generateUrl('user_resetting_request'));
}

return $this->render('@ImaticUser/Resetting/check_email.html.twig', [
Expand All @@ -79,11 +79,11 @@ public function resetAction(Request $request, $token, UserManager $userManager)
{
$user = $userManager->findUserByConfirmationToken($token);
if (null === $user) {
return new RedirectResponse($this->generateUrl('fos_user_security_login'));
return new RedirectResponse($this->generateUrl('user_security_login'));
}

if (!$user->isPasswordRequestNonExpired($this->tokenTtl)) {
return new RedirectResponse($this->generateUrl('fos_user_resetting_request'));
return new RedirectResponse($this->generateUrl('user_resetting_request'));
}

$form = $this->createForm(ResettingFormType::class, $user);
Expand All @@ -94,7 +94,7 @@ public function resetAction(Request $request, $token, UserManager $userManager)
$user->setEnabled(true);
$userManager->updateUser($user);

return new RedirectResponse($this->generateUrl('fos_user_profile_show'));
return new RedirectResponse($this->generateUrl('user_profile_show'));
}

return $this->render('@ImaticUser/Resetting/reset.html.twig', [
Expand Down
Loading