From 9565270c19cdc345225ec44ff0b3e4c046f95d41 Mon Sep 17 00:00:00 2001 From: flo Date: Sat, 4 Jan 2025 02:11:41 +0100 Subject: [PATCH] weedkeeper changes 2 --- .env.example | 13 ++ composer.json | 11 +- config/config.php | 2 +- src/ApiDomain/Console/config/console.php | 4 + .../Console/config/service_manager.php | 4 + .../src/Command/ExportModelsCommand.php | 51 ++++++ .../src/Command/ExportSchemaCommand.php | 46 ++++++ src/ApiDomain/External/Api/config/routes.php | 36 +++++ .../External/Api/config/service_manager.php | 18 +++ .../External/Api/src/ConfigProvider.php | 16 ++ .../Api/src/Health/HealthRequestHandler.php | 23 +++ .../Api/src/Schema/SchemaRequestHandler.php | 29 ++++ .../External/Authentication/config/routes.php | 43 +++-- .../Authentication/config/service_manager.php | 40 +++-- .../ConfirmRegistrationRequestHandler.php | 40 +++++ .../ConfirmRegistrationResponseFormatter.php | 31 ++++ .../ForgotPasswordRequestHandler.php | 37 +++++ .../ForgotPasswordResponseFormatter.php | 16 ++ .../Handler/ConfirmRegistrationHandler.php | 44 ----- .../src/Handler/LoginUserHandler.php | 42 ----- .../src/Handler/LogoutUserHandler.php | 35 ---- .../src/Handler/RegisterUserHandler.php | 41 ----- .../src/LoginUser/LoginUserRequestHandler.php | 41 +++++ .../LoginUser/LoginUserResponseFormatter.php | 18 +++ .../LogoutUser/LogoutUserRequestHandler.php | 39 +++++ .../LogoutUserResponseFormatter.php | 16 ++ .../RegisterUserRequestHandler.php | 38 +++++ .../RegisterUserResponseFormatter.php | 16 ++ .../ResetPasswordRequestHandler.php | 40 +++++ .../ResetPasswordResponseFormatter.php | 16 ++ .../External/Health/config/routes.php | 16 -- .../Health/config/service_manager.php | 12 -- .../External/Health/src/ConfigProvider.php | 16 -- .../Health/src/Handler/HealthHandler.php | 23 --- src/ApiDomain/External/User/config/routes.php | 43 +++-- .../External/User/config/service_manager.php | 39 +++-- .../ChangePasswordRequestHandler.php | 43 +++++ .../ChangePasswordResponseFormatter.php | 16 ++ .../ChangeUsernameRequestHandler.php | 43 +++++ .../ChangeUsernameResponseFormatter.php | 16 ++ .../User/src/Create/CreateRequestHandler.php | 39 +++++ .../src/Create/CreateResponseFormatter.php | 30 ++++ .../User/src/Formatter/UserFormatter.php | 27 ---- .../src/Handler/ChangePasswordHandler.php | 43 ----- .../src/Handler/ChangeUsernameHandler.php | 43 ----- .../User/src/Handler/CreateUserHandler.php | 44 ----- .../User/src/Handler/UserStateHandler.php | 34 ---- .../src/ReadList/ReadListRequestHandler.php | 39 +++++ .../ReadList/ReadListResponseFormatter.php | 18 +++ .../User/src/State/StateRequestHandler.php | 29 ++++ .../User/src/State/StateResponseFormatter.php | 29 ++++ .../External/User/UserState/response.json | 2 +- .../Authentication/config/service_manager.php | 41 +++++ .../src/Builder/UserSessionBuilder.php | 2 +- .../Authentication/src/ConfigProvider.php | 15 ++ .../src/Rule/UserPasswordMatchesRule.php | 2 +- .../ForgotPassword/ForgotPasswordUseCase.php | 18 +++ .../ForgotPasswordUseCaseBuilder.php | 16 ++ .../ForgotPasswordUseCaseHandler.php | 17 ++ .../ForgotPasswordUseCaseResult.php | 12 ++ .../UseCase/LoginUser/LoginUserUseCase.php | 32 ++++ .../LoginUser/LoginUserUseCaseBuilder.php | 22 +++ .../LoginUser/LoginUserUseCaseHandler.php} | 150 ++++++++---------- .../LoginUser/LoginUserUseCaseResult.php | 20 +++ .../UseCase/LogoutUser/LogoutUserUseCase.php | 20 +++ .../LogoutUser/LogoutUserUseCaseBuilder.php | 18 +++ .../LogoutUser/LogoutUserUseCaseHandler.php | 25 +++ .../LogoutUser/LogoutUserUseCaseResult.php | 12 ++ .../ResetPassword/ResetPasswordUseCase.php | 32 ++++ .../ResetPasswordUseCaseBuilder.php | 22 +++ .../ResetPasswordUseCaseHandler.php | 17 ++ .../ResetPasswordUseCaseResult.php | 12 ++ .../Registration/config/service_manager.php | 21 ++- .../RegistrationNotFoundByIdException.php | 4 +- ...onWithIdentifierAlreadyExistsException.php | 4 +- .../ConfirmRegistrationCommand.php | 28 ---- .../ConfirmRegistrationCommandBuilder.php | 21 --- .../ConfirmRegistrationCommandHandler.php | 23 --- .../RegisterUser/RegisterUserCommand.php | 25 --- .../RegisterUserCommandBuilder.php | 19 --- .../RegisterUserCommandHandler.php | 23 --- .../ConfirmRegistrationPayload.php | 5 +- .../Step/CreateUserStep.php | 10 +- .../Step/LoadRegistrationStep.php | 9 +- .../RegisterUser/RegisterUserPayload.php | 7 +- .../Step/BuildRegistrationStep.php | 6 +- .../RegisterUser/Step/CheckIdentifierStep.php | 10 +- .../RegisterUser/Step/SendMailStep.php | 8 +- .../ConfirmRegistrationUseCase.php | 32 ++++ .../ConfirmRegistrationUseCaseBuilder.php | 22 +++ .../ConfirmRegistrationUseCaseHandler.php | 24 +++ .../ConfirmRegistrationUseCaseResult.php | 20 +++ .../RegisterUser/RegisterUserUseCase.php | 24 +++ .../RegisterUserUseCaseBuilder.php | 18 +++ .../RegisterUserUseCaseHandler.php | 24 +++ .../RegisterUserUseCaseResult.php | 20 +++ .../User/config/service_manager.php | 37 +++-- .../User/src/Builder/UserBuilder.php | 2 +- .../UserNotFoundByIdentifierException.php | 8 +- .../UserPasswordMismatchException.php | 4 +- ...erWithIdentifierAlreadyExistsException.php | 4 +- .../Exception/UserWrongPasswordException.php | 4 +- .../ChangePassword/ChangePasswordCommand.php | 27 ---- .../ChangePasswordCommandBuilder.php | 21 --- .../ChangePasswordCommandHandler.php | 39 ----- .../ChangeUsername/ChangeUsernameCommand.php | 28 ---- .../ChangeUsernameCommandBuilder.php | 21 --- .../ChangeUsernameCommandHandler.php | 30 ---- .../Command/CreateUser/CreateUserCommand.php | 25 --- .../CreateUser/CreateUserCommandBuilder.php | 19 --- .../CreateUser/CreateUserCommandHandler.php | 39 ----- .../ChangePassword/ChangePasswordUseCase.php | 32 ++++ .../ChangePasswordUseCaseBuilder.php | 22 +++ .../ChangePasswordUseCaseHandler.php | 40 +++++ .../ChangePasswordUseCaseResult.php | 12 ++ .../ChangeUsername/ChangeUsernameUseCase.php | 32 ++++ .../ChangeUsernameUseCaseBuilder.php | 22 +++ .../ChangeUsernameUseCaseHandler.php | 37 +++++ .../ChangeUsernameUseCaseResult.php | 12 ++ .../User/src/UseCase/Create/CreateUseCase.php | 30 ++++ .../UseCase/Create/CreateUseCaseBuilder.php | 20 +++ .../UseCase/Create/CreateUseCaseHandler.php | 37 +++++ .../UseCase/Create/CreateUseCaseResult.php | 20 +++ .../src/UseCase/ReadList/ReadListUseCase.php | 30 ++++ .../ReadList/ReadListUseCaseBuilder.php | 20 +++ .../ReadList/ReadListUseCaseHandler.php | 17 ++ .../ReadList/ReadListUseCaseResult.php | 12 ++ .../UserSession/config/service_manager.php | 31 ---- .../UserSession/src/ConfigProvider.php | 15 -- .../Command/LoginUser/LoginUserCommand.php | 29 ---- .../LoginUser/LoginUserCommandBuilder.php | 23 --- .../Command/LogoutUser/LogoutUserCommand.php | 19 --- .../LogoutUser/LogoutUserCommandBuilder.php | 19 --- .../LogoutUser/LogoutUserCommandHandler.php | 37 ----- .../RoleNotFoundByIdentifierException.php | 6 +- .../Schema/src/Exporter/BackendExporter.php | 2 +- .../src/Middleware/SessionMiddleware.php | 2 +- 137 files changed, 2104 insertions(+), 1184 deletions(-) create mode 100644 src/ApiDomain/Console/src/Command/ExportModelsCommand.php create mode 100644 src/ApiDomain/Console/src/Command/ExportSchemaCommand.php create mode 100644 src/ApiDomain/External/Api/config/routes.php create mode 100644 src/ApiDomain/External/Api/config/service_manager.php create mode 100644 src/ApiDomain/External/Api/src/ConfigProvider.php create mode 100644 src/ApiDomain/External/Api/src/Health/HealthRequestHandler.php create mode 100644 src/ApiDomain/External/Api/src/Schema/SchemaRequestHandler.php create mode 100644 src/ApiDomain/External/Authentication/src/ConfirmRegistration/ConfirmRegistrationRequestHandler.php create mode 100644 src/ApiDomain/External/Authentication/src/ConfirmRegistration/ConfirmRegistrationResponseFormatter.php create mode 100644 src/ApiDomain/External/Authentication/src/ForgotPassword/ForgotPasswordRequestHandler.php create mode 100644 src/ApiDomain/External/Authentication/src/ForgotPassword/ForgotPasswordResponseFormatter.php delete mode 100644 src/ApiDomain/External/Authentication/src/Handler/ConfirmRegistrationHandler.php delete mode 100644 src/ApiDomain/External/Authentication/src/Handler/LoginUserHandler.php delete mode 100644 src/ApiDomain/External/Authentication/src/Handler/LogoutUserHandler.php delete mode 100644 src/ApiDomain/External/Authentication/src/Handler/RegisterUserHandler.php create mode 100644 src/ApiDomain/External/Authentication/src/LoginUser/LoginUserRequestHandler.php create mode 100644 src/ApiDomain/External/Authentication/src/LoginUser/LoginUserResponseFormatter.php create mode 100644 src/ApiDomain/External/Authentication/src/LogoutUser/LogoutUserRequestHandler.php create mode 100644 src/ApiDomain/External/Authentication/src/LogoutUser/LogoutUserResponseFormatter.php create mode 100644 src/ApiDomain/External/Authentication/src/RegisterUser/RegisterUserRequestHandler.php create mode 100644 src/ApiDomain/External/Authentication/src/RegisterUser/RegisterUserResponseFormatter.php create mode 100644 src/ApiDomain/External/Authentication/src/ResetPassword/ResetPasswordRequestHandler.php create mode 100644 src/ApiDomain/External/Authentication/src/ResetPassword/ResetPasswordResponseFormatter.php delete mode 100644 src/ApiDomain/External/Health/config/routes.php delete mode 100644 src/ApiDomain/External/Health/config/service_manager.php delete mode 100644 src/ApiDomain/External/Health/src/ConfigProvider.php delete mode 100644 src/ApiDomain/External/Health/src/Handler/HealthHandler.php create mode 100644 src/ApiDomain/External/User/src/ChangePassword/ChangePasswordRequestHandler.php create mode 100644 src/ApiDomain/External/User/src/ChangePassword/ChangePasswordResponseFormatter.php create mode 100644 src/ApiDomain/External/User/src/ChangeUsername/ChangeUsernameRequestHandler.php create mode 100644 src/ApiDomain/External/User/src/ChangeUsername/ChangeUsernameResponseFormatter.php create mode 100644 src/ApiDomain/External/User/src/Create/CreateRequestHandler.php create mode 100644 src/ApiDomain/External/User/src/Create/CreateResponseFormatter.php delete mode 100644 src/ApiDomain/External/User/src/Formatter/UserFormatter.php delete mode 100644 src/ApiDomain/External/User/src/Handler/ChangePasswordHandler.php delete mode 100644 src/ApiDomain/External/User/src/Handler/ChangeUsernameHandler.php delete mode 100644 src/ApiDomain/External/User/src/Handler/CreateUserHandler.php delete mode 100644 src/ApiDomain/External/User/src/Handler/UserStateHandler.php create mode 100644 src/ApiDomain/External/User/src/ReadList/ReadListRequestHandler.php create mode 100644 src/ApiDomain/External/User/src/ReadList/ReadListResponseFormatter.php create mode 100644 src/ApiDomain/External/User/src/State/StateRequestHandler.php create mode 100644 src/ApiDomain/External/User/src/State/StateResponseFormatter.php create mode 100644 src/HandlingDomain/Authentication/config/service_manager.php rename src/HandlingDomain/{UserSession => Authentication}/src/Builder/UserSessionBuilder.php (82%) create mode 100644 src/HandlingDomain/Authentication/src/ConfigProvider.php rename src/HandlingDomain/{UserSession => Authentication}/src/Rule/UserPasswordMatchesRule.php (90%) create mode 100644 src/HandlingDomain/Authentication/src/UseCase/ForgotPassword/ForgotPasswordUseCase.php create mode 100644 src/HandlingDomain/Authentication/src/UseCase/ForgotPassword/ForgotPasswordUseCaseBuilder.php create mode 100644 src/HandlingDomain/Authentication/src/UseCase/ForgotPassword/ForgotPasswordUseCaseHandler.php create mode 100644 src/HandlingDomain/Authentication/src/UseCase/ForgotPassword/ForgotPasswordUseCaseResult.php create mode 100644 src/HandlingDomain/Authentication/src/UseCase/LoginUser/LoginUserUseCase.php create mode 100644 src/HandlingDomain/Authentication/src/UseCase/LoginUser/LoginUserUseCaseBuilder.php rename src/HandlingDomain/{UserSession/src/Handler/Command/LoginUser/LoginUserCommandHandler.php => Authentication/src/UseCase/LoginUser/LoginUserUseCaseHandler.php} (64%) create mode 100644 src/HandlingDomain/Authentication/src/UseCase/LoginUser/LoginUserUseCaseResult.php create mode 100644 src/HandlingDomain/Authentication/src/UseCase/LogoutUser/LogoutUserUseCase.php create mode 100644 src/HandlingDomain/Authentication/src/UseCase/LogoutUser/LogoutUserUseCaseBuilder.php create mode 100644 src/HandlingDomain/Authentication/src/UseCase/LogoutUser/LogoutUserUseCaseHandler.php create mode 100644 src/HandlingDomain/Authentication/src/UseCase/LogoutUser/LogoutUserUseCaseResult.php create mode 100644 src/HandlingDomain/Authentication/src/UseCase/ResetPassword/ResetPasswordUseCase.php create mode 100644 src/HandlingDomain/Authentication/src/UseCase/ResetPassword/ResetPasswordUseCaseBuilder.php create mode 100644 src/HandlingDomain/Authentication/src/UseCase/ResetPassword/ResetPasswordUseCaseHandler.php create mode 100644 src/HandlingDomain/Authentication/src/UseCase/ResetPassword/ResetPasswordUseCaseResult.php delete mode 100644 src/HandlingDomain/Registration/src/Handler/Command/ConfirmRegistration/ConfirmRegistrationCommand.php delete mode 100644 src/HandlingDomain/Registration/src/Handler/Command/ConfirmRegistration/ConfirmRegistrationCommandBuilder.php delete mode 100644 src/HandlingDomain/Registration/src/Handler/Command/ConfirmRegistration/ConfirmRegistrationCommandHandler.php delete mode 100644 src/HandlingDomain/Registration/src/Handler/Command/RegisterUser/RegisterUserCommand.php delete mode 100644 src/HandlingDomain/Registration/src/Handler/Command/RegisterUser/RegisterUserCommandBuilder.php delete mode 100644 src/HandlingDomain/Registration/src/Handler/Command/RegisterUser/RegisterUserCommandHandler.php create mode 100644 src/HandlingDomain/Registration/src/UseCase/ConfirmRegistration/ConfirmRegistrationUseCase.php create mode 100644 src/HandlingDomain/Registration/src/UseCase/ConfirmRegistration/ConfirmRegistrationUseCaseBuilder.php create mode 100644 src/HandlingDomain/Registration/src/UseCase/ConfirmRegistration/ConfirmRegistrationUseCaseHandler.php create mode 100644 src/HandlingDomain/Registration/src/UseCase/ConfirmRegistration/ConfirmRegistrationUseCaseResult.php create mode 100644 src/HandlingDomain/Registration/src/UseCase/RegisterUser/RegisterUserUseCase.php create mode 100644 src/HandlingDomain/Registration/src/UseCase/RegisterUser/RegisterUserUseCaseBuilder.php create mode 100644 src/HandlingDomain/Registration/src/UseCase/RegisterUser/RegisterUserUseCaseHandler.php create mode 100644 src/HandlingDomain/Registration/src/UseCase/RegisterUser/RegisterUserUseCaseResult.php delete mode 100644 src/HandlingDomain/User/src/Handler/Command/ChangePassword/ChangePasswordCommand.php delete mode 100644 src/HandlingDomain/User/src/Handler/Command/ChangePassword/ChangePasswordCommandBuilder.php delete mode 100644 src/HandlingDomain/User/src/Handler/Command/ChangePassword/ChangePasswordCommandHandler.php delete mode 100644 src/HandlingDomain/User/src/Handler/Command/ChangeUsername/ChangeUsernameCommand.php delete mode 100644 src/HandlingDomain/User/src/Handler/Command/ChangeUsername/ChangeUsernameCommandBuilder.php delete mode 100644 src/HandlingDomain/User/src/Handler/Command/ChangeUsername/ChangeUsernameCommandHandler.php delete mode 100644 src/HandlingDomain/User/src/Handler/Command/CreateUser/CreateUserCommand.php delete mode 100644 src/HandlingDomain/User/src/Handler/Command/CreateUser/CreateUserCommandBuilder.php delete mode 100644 src/HandlingDomain/User/src/Handler/Command/CreateUser/CreateUserCommandHandler.php create mode 100644 src/HandlingDomain/User/src/UseCase/ChangePassword/ChangePasswordUseCase.php create mode 100644 src/HandlingDomain/User/src/UseCase/ChangePassword/ChangePasswordUseCaseBuilder.php create mode 100644 src/HandlingDomain/User/src/UseCase/ChangePassword/ChangePasswordUseCaseHandler.php create mode 100644 src/HandlingDomain/User/src/UseCase/ChangePassword/ChangePasswordUseCaseResult.php create mode 100644 src/HandlingDomain/User/src/UseCase/ChangeUsername/ChangeUsernameUseCase.php create mode 100644 src/HandlingDomain/User/src/UseCase/ChangeUsername/ChangeUsernameUseCaseBuilder.php create mode 100644 src/HandlingDomain/User/src/UseCase/ChangeUsername/ChangeUsernameUseCaseHandler.php create mode 100644 src/HandlingDomain/User/src/UseCase/ChangeUsername/ChangeUsernameUseCaseResult.php create mode 100644 src/HandlingDomain/User/src/UseCase/Create/CreateUseCase.php create mode 100644 src/HandlingDomain/User/src/UseCase/Create/CreateUseCaseBuilder.php create mode 100644 src/HandlingDomain/User/src/UseCase/Create/CreateUseCaseHandler.php create mode 100644 src/HandlingDomain/User/src/UseCase/Create/CreateUseCaseResult.php create mode 100644 src/HandlingDomain/User/src/UseCase/ReadList/ReadListUseCase.php create mode 100644 src/HandlingDomain/User/src/UseCase/ReadList/ReadListUseCaseBuilder.php create mode 100644 src/HandlingDomain/User/src/UseCase/ReadList/ReadListUseCaseHandler.php create mode 100644 src/HandlingDomain/User/src/UseCase/ReadList/ReadListUseCaseResult.php delete mode 100644 src/HandlingDomain/UserSession/config/service_manager.php delete mode 100644 src/HandlingDomain/UserSession/src/ConfigProvider.php delete mode 100644 src/HandlingDomain/UserSession/src/Handler/Command/LoginUser/LoginUserCommand.php delete mode 100644 src/HandlingDomain/UserSession/src/Handler/Command/LoginUser/LoginUserCommandBuilder.php delete mode 100644 src/HandlingDomain/UserSession/src/Handler/Command/LogoutUser/LogoutUserCommand.php delete mode 100644 src/HandlingDomain/UserSession/src/Handler/Command/LogoutUser/LogoutUserCommandBuilder.php delete mode 100644 src/HandlingDomain/UserSession/src/Handler/Command/LogoutUser/LogoutUserCommandHandler.php rename src/{HandlingDomain/Role => Infrastructure/Rbac}/src/Exception/RoleNotFoundByIdentifierException.php (71%) diff --git a/.env.example b/.env.example index dc4e8de..d90363e 100644 --- a/.env.example +++ b/.env.example @@ -10,6 +10,19 @@ DB_NAME_LOG=log # API Keys TEMPLATE_API_KEY= +# Mail +MAIL_DEFAULT_SENDER=template@stack-up.de +MAIL_DEFAULT_SENDER_NAME=Template +SMTP_USERNAME= +SMTP_PASSWORD= +SMTP_HOST= +SMTP_PORT= +SMTP_ENCRYPTION=ssl + +# Notification +NOTIFICATION_HOST= +NOTIFICATION_ID= + # Template Setup INIT_USER_NAME=admin INIT_USER_PASSWORD=password diff --git a/composer.json b/composer.json index 6413085..5f99ead 100644 --- a/composer.json +++ b/composer.json @@ -15,11 +15,13 @@ "symfony/cache": "5.4.8", "doctrine/dbal": "^3.6", "teewurst/psr4-advanced-wildcard-composer-plugin": "^3.0", - "laminas/laminas-crypt": "^3.10", "monolog/monolog": "^3.4", - "laminas/laminas-mail": "^2.23", "teewurst/pipeline": "^3.0", - "guzzlehttp/guzzle": "^7.8" + "guzzlehttp/guzzle": "^7.8", + "nette/mail": "^4.0", + "latte/latte": "^3.0", + "league/openapi-psr7-validator": "^0.22.0", + "symfony/finder": "^6.4" }, "autoload": { "psr-4": { @@ -66,6 +68,7 @@ ] }, "config": { + "process-timeout": 0, "allow-plugins": { "teewurst/psr4-advanced-wildcard-composer-plugin": true } @@ -73,4 +76,4 @@ "require-dev": { "symfony/dotenv": "^6.3" } -} +} \ No newline at end of file diff --git a/config/config.php b/config/config.php index 35d96fb..2e8f5b6 100644 --- a/config/config.php +++ b/config/config.php @@ -58,7 +58,7 @@ $aggregator = new ConfigAggregator([ // HandlingDomain \Template\Handling\User\ConfigProvider::class, - \Template\Handling\UserSession\ConfigProvider::class, + \Template\Handling\Authentication\ConfigProvider::class, \Template\Handling\Registration\ConfigProvider::class, // API diff --git a/src/ApiDomain/Console/config/console.php b/src/ApiDomain/Console/config/console.php index 20093d4..e40c681 100644 --- a/src/ApiDomain/Console/config/console.php +++ b/src/ApiDomain/Console/config/console.php @@ -1,5 +1,7 @@ [ InitializeDataCommand::class, RbacUpdateCommand::class, + ExportModelsCommand::class, + ExportSchemaCommand::class, ] ]; diff --git a/src/ApiDomain/Console/config/service_manager.php b/src/ApiDomain/Console/config/service_manager.php index 9aa3afc..a54605e 100644 --- a/src/ApiDomain/Console/config/service_manager.php +++ b/src/ApiDomain/Console/config/service_manager.php @@ -1,5 +1,7 @@ [ InitializeDataCommand::class => AutoWiringFactory::class, RbacUpdateCommand::class => AutoWiringFactory::class, + ExportModelsCommand::class => AutoWiringFactory::class, + ExportSchemaCommand::class => AutoWiringFactory::class, ], ]; diff --git a/src/ApiDomain/Console/src/Command/ExportModelsCommand.php b/src/ApiDomain/Console/src/Command/ExportModelsCommand.php new file mode 100644 index 0000000..042a48b --- /dev/null +++ b/src/ApiDomain/Console/src/Command/ExportModelsCommand.php @@ -0,0 +1,51 @@ +getName()); + } + + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { + $io = new SymfonyStyle($input, $output); + + try { + $this->backendExporter->export(); + + $this->frontendExporter->export(); + + $io->success("OK!"); + } catch (Throwable $e) { + $io->error($e->getMessage()); + $io->error($e->getTraceAsString()); + $this->logger->error($e->getMessage(), ['exception' => $e]); + return Command::FAILURE; + } + + return Command::SUCCESS; + } +} diff --git a/src/ApiDomain/Console/src/Command/ExportSchemaCommand.php b/src/ApiDomain/Console/src/Command/ExportSchemaCommand.php new file mode 100644 index 0000000..09ed9f2 --- /dev/null +++ b/src/ApiDomain/Console/src/Command/ExportSchemaCommand.php @@ -0,0 +1,46 @@ +getName()); + } + + protected function execute( + InputInterface $input, + OutputInterface $output + ): int { + $io = new SymfonyStyle($input, $output); + + try { + file_put_contents( + APP_ROOT . '/var/export/schema/api.export.json', + json_encode($this->schema->getSerializableData(), JSON_PRETTY_PRINT) + ); + + $io->success("OK!"); + } catch (Throwable $e) { + $io->error($e->getMessage()); + $io->error($e->getTraceAsString()); + $this->logger->error($e->getMessage(), ['exception' => $e]); + return Command::FAILURE; + } + + return Command::SUCCESS; + } +} diff --git a/src/ApiDomain/External/Api/config/routes.php b/src/ApiDomain/External/Api/config/routes.php new file mode 100644 index 0000000..bcd8a42 --- /dev/null +++ b/src/ApiDomain/External/Api/config/routes.php @@ -0,0 +1,36 @@ + 'api.health', + 'path' => '/api/health', + 'allowed_methods' => ['GET'], + 'middleware' => [ + SchemaValidationMiddleware::class, + LoggedInUserMiddleware::class, + EnsureAuthorizationMiddleware::class, + HealthRequestHandler::class, + ], + ], + [ + 'name' => 'api.schema', + 'path' => '/api/schema', + 'allowed_methods' => ['GET'], + 'middleware' => [ + SchemaValidationMiddleware::class, + LoggedInUserMiddleware::class, + EnsureAuthorizationMiddleware::class, + SchemaRequestHandler::class, + ], + ], +]; diff --git a/src/ApiDomain/External/Api/config/service_manager.php b/src/ApiDomain/External/Api/config/service_manager.php new file mode 100644 index 0000000..8dd947a --- /dev/null +++ b/src/ApiDomain/External/Api/config/service_manager.php @@ -0,0 +1,18 @@ + [ + /// Health + HealthRequestHandler::class => AutoWiringFactory::class, + /// Schema + SchemaRequestHandler::class => AutoWiringFactory::class, + ] +]; diff --git a/src/ApiDomain/External/Api/src/ConfigProvider.php b/src/ApiDomain/External/Api/src/ConfigProvider.php new file mode 100644 index 0000000..22eeb85 --- /dev/null +++ b/src/ApiDomain/External/Api/src/ConfigProvider.php @@ -0,0 +1,16 @@ + require __DIR__ . '/./../config/service_manager.php', + 'routes' => require __DIR__ . '/./../config/routes.php', + ]; + } +} \ No newline at end of file diff --git a/src/ApiDomain/External/Api/src/Health/HealthRequestHandler.php b/src/ApiDomain/External/Api/src/Health/HealthRequestHandler.php new file mode 100644 index 0000000..05916df --- /dev/null +++ b/src/ApiDomain/External/Api/src/Health/HealthRequestHandler.php @@ -0,0 +1,23 @@ +schema->getSerializableData()), + true + ); + + return new SuccessResponse($response); + } +} \ No newline at end of file diff --git a/src/ApiDomain/External/Authentication/config/routes.php b/src/ApiDomain/External/Authentication/config/routes.php index b776574..17617af 100644 --- a/src/ApiDomain/External/Authentication/config/routes.php +++ b/src/ApiDomain/External/Authentication/config/routes.php @@ -1,10 +1,13 @@ '/api/auth/login-user', 'allowed_methods' => ['POST'], 'middleware' => [ - LoginUserHandler::class + SchemaValidationMiddleware::class, + LoginUserRequestHandler::class, ], ], [ 'name' => 'auth.logout-user', 'path' => '/api/auth/logout-user', - 'allowed_methods' => ['POST'], + 'allowed_methods' => ['GET'], 'middleware' => [ + SchemaValidationMiddleware::class, LoggedInUserMiddleware::class, - LogoutUserHandler::class + LogoutUserRequestHandler::class, ], ], [ @@ -29,7 +34,8 @@ return [ 'path' => '/api/auth/confirm-registration', 'allowed_methods' => ['POST'], 'middleware' => [ - ConfirmRegistrationHandler::class + SchemaValidationMiddleware::class, + ConfirmRegistrationRequestHandler::class, ], ], [ @@ -37,7 +43,26 @@ return [ 'path' => '/api/auth/register-user', 'allowed_methods' => ['POST'], 'middleware' => [ - RegisterUserHandler::class + SchemaValidationMiddleware::class, + RegisterUserRequestHandler::class, + ], + ], + [ + 'name' => 'auth.forgot-password', + 'path' => '/api/auth/forgot-password', + 'allowed_methods' => ['POST'], + 'middleware' => [ + SchemaValidationMiddleware::class, + ForgotPasswordRequestHandler::class, + ], + ], + [ + 'name' => 'auth.reset-password', + 'path' => '/api/auth/reset-password', + 'allowed_methods' => ['POST'], + 'middleware' => [ + SchemaValidationMiddleware::class, + ResetPasswordRequestHandler::class, ], ], ]; \ No newline at end of file diff --git a/src/ApiDomain/External/Authentication/config/service_manager.php b/src/ApiDomain/External/Authentication/config/service_manager.php index fc34f4e..eb98bbd 100644 --- a/src/ApiDomain/External/Authentication/config/service_manager.php +++ b/src/ApiDomain/External/Authentication/config/service_manager.php @@ -1,17 +1,39 @@ [ - // Handler - LoginUserHandler::class => AutoWiringFactory::class, - LogoutUserHandler::class => AutoWiringFactory::class, - ConfirmRegistrationHandler::class => AutoWiringFactory::class, - RegisterUserHandler::class => AutoWiringFactory::class + /// LoginUser + LoginUserResponseFormatter::class => AutoWiringFactory::class, + LoginUserRequestHandler::class => AutoWiringFactory::class, + /// LogoutUser + LogoutUserResponseFormatter::class => AutoWiringFactory::class, + LogoutUserRequestHandler::class => AutoWiringFactory::class, + /// ConfirmRegistration + ConfirmRegistrationResponseFormatter::class => AutoWiringFactory::class, + ConfirmRegistrationRequestHandler::class => AutoWiringFactory::class, + /// RegisterUser + RegisterUserResponseFormatter::class => AutoWiringFactory::class, + RegisterUserRequestHandler::class => AutoWiringFactory::class, + /// ForgotPassword + ForgotPasswordResponseFormatter::class => AutoWiringFactory::class, + ForgotPasswordRequestHandler::class => AutoWiringFactory::class, + /// ResetPassword + ResetPasswordResponseFormatter::class => AutoWiringFactory::class, + ResetPasswordRequestHandler::class => AutoWiringFactory::class, ], ]; diff --git a/src/ApiDomain/External/Authentication/src/ConfirmRegistration/ConfirmRegistrationRequestHandler.php b/src/ApiDomain/External/Authentication/src/ConfirmRegistration/ConfirmRegistrationRequestHandler.php new file mode 100644 index 0000000..9ece770 --- /dev/null +++ b/src/ApiDomain/External/Authentication/src/ConfirmRegistration/ConfirmRegistrationRequestHandler.php @@ -0,0 +1,40 @@ +getAttribute(AnalyzeBodyMiddleware::JSON_DATA); + + $useCase = $this->builder->build( + Uuid::fromString($data['id']), + $data['password'], + $data['passwordConfirmation'], + ); + $result = $this->handler->handle($useCase); + + $response = $this->responseFormatter->format($result); + return new SuccessResponse($response); + } +} \ No newline at end of file diff --git a/src/ApiDomain/External/Authentication/src/ConfirmRegistration/ConfirmRegistrationResponseFormatter.php b/src/ApiDomain/External/Authentication/src/ConfirmRegistration/ConfirmRegistrationResponseFormatter.php new file mode 100644 index 0000000..ac5c6fe --- /dev/null +++ b/src/ApiDomain/External/Authentication/src/ConfirmRegistration/ConfirmRegistrationResponseFormatter.php @@ -0,0 +1,31 @@ +getUser(); + + $permissions = []; + foreach ($user->getRole()->getPermissions()->toArray() as $permission) { + $permissions[] = $permission->getIdentifier(); + } + + return [ + 'id' => $user->getId()->toString(), + 'username' => $user->getUsername(), + 'role' => $user->getRole()->getIdentifier(), + 'permissions' => $permissions, + 'created' => $user->getCreatedAt()->format(DateTimeInterface::RFC3339), + 'updated' => $user->getUpdatedAt()->format(DateTimeInterface::RFC3339) + ]; + } +} \ No newline at end of file diff --git a/src/ApiDomain/External/Authentication/src/ForgotPassword/ForgotPasswordRequestHandler.php b/src/ApiDomain/External/Authentication/src/ForgotPassword/ForgotPasswordRequestHandler.php new file mode 100644 index 0000000..f7d066f --- /dev/null +++ b/src/ApiDomain/External/Authentication/src/ForgotPassword/ForgotPasswordRequestHandler.php @@ -0,0 +1,37 @@ +getAttribute(AnalyzeBodyMiddleware::JSON_DATA); + + $useCase = $this->builder->build( + $data['mail'], + ); + $result = $this->handler->handle($useCase); + + $response = $this->responseFormatter->format($result); + return new SuccessResponse($response); + } +} \ No newline at end of file diff --git a/src/ApiDomain/External/Authentication/src/ForgotPassword/ForgotPasswordResponseFormatter.php b/src/ApiDomain/External/Authentication/src/ForgotPassword/ForgotPasswordResponseFormatter.php new file mode 100644 index 0000000..2e39ac5 --- /dev/null +++ b/src/ApiDomain/External/Authentication/src/ForgotPassword/ForgotPasswordResponseFormatter.php @@ -0,0 +1,16 @@ +getBody()->getContents(), - true - ); - - $query = $this->builder->build( - Uuid::fromString($data['id']), - $data['password'], - $data['passwordConfirmation'], - ); - - $result = $this->handler->execute($query); - return new JsonResponse( - $this->userFormatter->format($result) - ); - } -} diff --git a/src/ApiDomain/External/Authentication/src/Handler/LoginUserHandler.php b/src/ApiDomain/External/Authentication/src/Handler/LoginUserHandler.php deleted file mode 100644 index 9582ec8..0000000 --- a/src/ApiDomain/External/Authentication/src/Handler/LoginUserHandler.php +++ /dev/null @@ -1,42 +0,0 @@ -getAttribute(SessionMiddleware::SESSION_ATTRIBUTE); - $data = json_decode( - $request->getBody()->getContents(), - true - ); - - $query = $this->builder->build( - $session, - $data['identifier'], - $data['password'], - ); - - $result = $this->handler->execute($query); - return new JsonResponse([ - 'sessionId' => $result->getId()->toString() - ]); - } -} diff --git a/src/ApiDomain/External/Authentication/src/Handler/LogoutUserHandler.php b/src/ApiDomain/External/Authentication/src/Handler/LogoutUserHandler.php deleted file mode 100644 index 0ab7328..0000000 --- a/src/ApiDomain/External/Authentication/src/Handler/LogoutUserHandler.php +++ /dev/null @@ -1,35 +0,0 @@ -getAttribute(SessionMiddleware::SESSION_ATTRIBUTE); - - $query = $this->builder->build( - $session - ); - $this->handler->execute($query); - - return new JsonResponse('OK'); - } -} diff --git a/src/ApiDomain/External/Authentication/src/Handler/RegisterUserHandler.php b/src/ApiDomain/External/Authentication/src/Handler/RegisterUserHandler.php deleted file mode 100644 index 7a330c2..0000000 --- a/src/ApiDomain/External/Authentication/src/Handler/RegisterUserHandler.php +++ /dev/null @@ -1,41 +0,0 @@ -getAttribute(AnalyzeHeaderMiddleware::HOST_ATTRIBUTE); - $data = json_decode( - $request->getBody()->getContents(), - true - ); - - $query = $this->builder->build( - $data['username'], - $data['mail'], - $host - ); - - $this->handler->execute($query); - return new SuccessResponse(); - } -} diff --git a/src/ApiDomain/External/Authentication/src/LoginUser/LoginUserRequestHandler.php b/src/ApiDomain/External/Authentication/src/LoginUser/LoginUserRequestHandler.php new file mode 100644 index 0000000..3d9a5ab --- /dev/null +++ b/src/ApiDomain/External/Authentication/src/LoginUser/LoginUserRequestHandler.php @@ -0,0 +1,41 @@ +getAttribute(SessionMiddleware::SESSION_ATTRIBUTE); + $data = $request->getAttribute(AnalyzeBodyMiddleware::JSON_DATA); + + $useCase = $this->builder->build( + $session, + $data['identifier'], + $data['password'], + ); + $result = $this->handler->handle($useCase); + + $response = $this->responseFormatter->format($result); + return new SuccessResponse($response); + } +} \ No newline at end of file diff --git a/src/ApiDomain/External/Authentication/src/LoginUser/LoginUserResponseFormatter.php b/src/ApiDomain/External/Authentication/src/LoginUser/LoginUserResponseFormatter.php new file mode 100644 index 0000000..c233c61 --- /dev/null +++ b/src/ApiDomain/External/Authentication/src/LoginUser/LoginUserResponseFormatter.php @@ -0,0 +1,18 @@ + $result->getSession()->getId() + ]; + } +} \ No newline at end of file diff --git a/src/ApiDomain/External/Authentication/src/LogoutUser/LogoutUserRequestHandler.php b/src/ApiDomain/External/Authentication/src/LogoutUser/LogoutUserRequestHandler.php new file mode 100644 index 0000000..d2193b7 --- /dev/null +++ b/src/ApiDomain/External/Authentication/src/LogoutUser/LogoutUserRequestHandler.php @@ -0,0 +1,39 @@ +getAttribute(SessionMiddleware::SESSION_ATTRIBUTE); + $data = $request->getAttribute(AnalyzeBodyMiddleware::JSON_DATA); + + $useCase = $this->builder->build( + $session, + ); + $result = $this->handler->handle($useCase); + + $response = $this->responseFormatter->format($result); + return new SuccessResponse($response); + } +} \ No newline at end of file diff --git a/src/ApiDomain/External/Authentication/src/LogoutUser/LogoutUserResponseFormatter.php b/src/ApiDomain/External/Authentication/src/LogoutUser/LogoutUserResponseFormatter.php new file mode 100644 index 0000000..2d0c2e4 --- /dev/null +++ b/src/ApiDomain/External/Authentication/src/LogoutUser/LogoutUserResponseFormatter.php @@ -0,0 +1,16 @@ +getAttribute(AnalyzeBodyMiddleware::JSON_DATA); + + $useCase = $this->builder->build( + $data['username'], + $data['mail'], + ); + $result = $this->handler->handle($useCase); + + $response = $this->responseFormatter->format($result); + return new SuccessResponse($response); + } +} \ No newline at end of file diff --git a/src/ApiDomain/External/Authentication/src/RegisterUser/RegisterUserResponseFormatter.php b/src/ApiDomain/External/Authentication/src/RegisterUser/RegisterUserResponseFormatter.php new file mode 100644 index 0000000..173ca0b --- /dev/null +++ b/src/ApiDomain/External/Authentication/src/RegisterUser/RegisterUserResponseFormatter.php @@ -0,0 +1,16 @@ +getAttribute(AnalyzeBodyMiddleware::JSON_DATA); + + $useCase = $this->builder->build( + Uuid::fromString($data['passwordToken']), + $data['newPassword'], + $data['passwordConfirmation'], + ); + $result = $this->handler->handle($useCase); + + $response = $this->responseFormatter->format($result); + return new SuccessResponse($response); + } +} \ No newline at end of file diff --git a/src/ApiDomain/External/Authentication/src/ResetPassword/ResetPasswordResponseFormatter.php b/src/ApiDomain/External/Authentication/src/ResetPassword/ResetPasswordResponseFormatter.php new file mode 100644 index 0000000..9ca8b81 --- /dev/null +++ b/src/ApiDomain/External/Authentication/src/ResetPassword/ResetPasswordResponseFormatter.php @@ -0,0 +1,16 @@ + 'health', - 'path' => '/api/health', - 'allowed_methods' => ['GET'], - 'middleware' => [ - HealthHandler::class - ], - ], -]; - -?> \ No newline at end of file diff --git a/src/ApiDomain/External/Health/config/service_manager.php b/src/ApiDomain/External/Health/config/service_manager.php deleted file mode 100644 index abdefca..0000000 --- a/src/ApiDomain/External/Health/config/service_manager.php +++ /dev/null @@ -1,12 +0,0 @@ - [ - HealthHandler::class => AutoWiringFactory::class - ], -] - -?> \ No newline at end of file diff --git a/src/ApiDomain/External/Health/src/ConfigProvider.php b/src/ApiDomain/External/Health/src/ConfigProvider.php deleted file mode 100644 index 217c876..0000000 --- a/src/ApiDomain/External/Health/src/ConfigProvider.php +++ /dev/null @@ -1,16 +0,0 @@ - require __DIR__ . './../config/service_manager.php', - 'routes' => require __DIR__ . '/./../config/routes.php', - ]; - } -} diff --git a/src/ApiDomain/External/Health/src/Handler/HealthHandler.php b/src/ApiDomain/External/Health/src/Handler/HealthHandler.php deleted file mode 100644 index 673e26f..0000000 --- a/src/ApiDomain/External/Health/src/Handler/HealthHandler.php +++ /dev/null @@ -1,23 +0,0 @@ - diff --git a/src/ApiDomain/External/User/config/routes.php b/src/ApiDomain/External/User/config/routes.php index cdb3833..28cdce8 100644 --- a/src/ApiDomain/External/User/config/routes.php +++ b/src/ApiDomain/External/User/config/routes.php @@ -1,21 +1,28 @@ 'user.create-user', - 'path' => '/api/user/create-user', + 'name' => 'user.create', + 'path' => '/api/user/create', 'allowed_methods' => ['POST'], 'middleware' => [ + SchemaValidationMiddleware::class, LoggedInUserMiddleware::class, EnsureAuthorizationMiddleware::class, - CreateUserHandler::class + CreateRequestHandler::class, ], ], [ @@ -23,8 +30,10 @@ return [ 'path' => '/api/user/change-password', 'allowed_methods' => ['POST'], 'middleware' => [ + SchemaValidationMiddleware::class, LoggedInUserMiddleware::class, - ChangePasswordHandler::class + EnsureAuthorizationMiddleware::class, + ChangePasswordRequestHandler::class, ], ], [ @@ -32,8 +41,21 @@ return [ 'path' => '/api/user/change-username', 'allowed_methods' => ['POST'], 'middleware' => [ + SchemaValidationMiddleware::class, LoggedInUserMiddleware::class, - ChangeUsernameHandler::class + EnsureAuthorizationMiddleware::class, + ChangeUsernameRequestHandler::class, + ], + ], + [ + 'name' => 'user.read-list', + 'path' => '/api/user/read-list', + 'allowed_methods' => ['POST'], + 'middleware' => [ + SchemaValidationMiddleware::class, + LoggedInUserMiddleware::class, + EnsureAuthorizationMiddleware::class, + ReadListRequestHandler::class, ], ], [ @@ -41,8 +63,9 @@ return [ 'path' => '/api/user/state', 'allowed_methods' => ['GET'], 'middleware' => [ + SchemaValidationMiddleware::class, LoggedInUserMiddleware::class, - UserStateHandler::class + StateRequestHandler::class, ], ], ]; diff --git a/src/ApiDomain/External/User/config/service_manager.php b/src/ApiDomain/External/User/config/service_manager.php index 3d7e7c4..c9f0d5e 100644 --- a/src/ApiDomain/External/User/config/service_manager.php +++ b/src/ApiDomain/External/User/config/service_manager.php @@ -1,21 +1,34 @@ [ - // Formatter - UserFormatter::class => AutoWiringFactory::class, - - // Handler - CreateUserHandler::class => AutoWiringFactory::class, - UserStateHandler::class => AutoWiringFactory::class, - ChangePasswordHandler::class => AutoWiringFactory::class, - ChangeUsernameHandler::class => AutoWiringFactory::class, + /// Create + CreateResponseFormatter::class => AutoWiringFactory::class, + CreateRequestHandler::class => AutoWiringFactory::class, + /// ChangePassword + ChangePasswordResponseFormatter::class => AutoWiringFactory::class, + ChangePasswordRequestHandler::class => AutoWiringFactory::class, + /// ChangeUsername + ChangeUsernameResponseFormatter::class => AutoWiringFactory::class, + ChangeUsernameRequestHandler::class => AutoWiringFactory::class, + /// ReadList + ReadListResponseFormatter::class => AutoWiringFactory::class, + ReadListRequestHandler::class => AutoWiringFactory::class, + /// State + StateResponseFormatter::class => AutoWiringFactory::class, + StateRequestHandler::class => AutoWiringFactory::class, ], ]; diff --git a/src/ApiDomain/External/User/src/ChangePassword/ChangePasswordRequestHandler.php b/src/ApiDomain/External/User/src/ChangePassword/ChangePasswordRequestHandler.php new file mode 100644 index 0000000..aad95f8 --- /dev/null +++ b/src/ApiDomain/External/User/src/ChangePassword/ChangePasswordRequestHandler.php @@ -0,0 +1,43 @@ +getAttribute(LoggedInUserMiddleware::USER_KEY); + $data = $request->getAttribute(AnalyzeBodyMiddleware::JSON_DATA); + + $useCase = $this->builder->build( + $user, + $data['password'], + $data['newPassword'], + ); + $result = $this->handler->handle($useCase); + + $response = $this->responseFormatter->format($result); + return new SuccessResponse($response); + } +} \ No newline at end of file diff --git a/src/ApiDomain/External/User/src/ChangePassword/ChangePasswordResponseFormatter.php b/src/ApiDomain/External/User/src/ChangePassword/ChangePasswordResponseFormatter.php new file mode 100644 index 0000000..0324093 --- /dev/null +++ b/src/ApiDomain/External/User/src/ChangePassword/ChangePasswordResponseFormatter.php @@ -0,0 +1,16 @@ +getAttribute(LoggedInUserMiddleware::USER_KEY); + $data = $request->getAttribute(AnalyzeBodyMiddleware::JSON_DATA); + + $useCase = $this->builder->build( + $user, + $data['password'], + $data['newUsername'], + ); + $result = $this->handler->handle($useCase); + + $response = $this->responseFormatter->format($result); + return new SuccessResponse($response); + } +} \ No newline at end of file diff --git a/src/ApiDomain/External/User/src/ChangeUsername/ChangeUsernameResponseFormatter.php b/src/ApiDomain/External/User/src/ChangeUsername/ChangeUsernameResponseFormatter.php new file mode 100644 index 0000000..6dc4986 --- /dev/null +++ b/src/ApiDomain/External/User/src/ChangeUsername/ChangeUsernameResponseFormatter.php @@ -0,0 +1,16 @@ +getAttribute(AnalyzeBodyMiddleware::JSON_DATA); + + $useCase = $this->builder->build( + $data['username'], + $data['mail'], + $data['password'], + ); + $result = $this->handler->handle($useCase); + + $response = $this->responseFormatter->format($result); + return new SuccessResponse($response); + } +} \ No newline at end of file diff --git a/src/ApiDomain/External/User/src/Create/CreateResponseFormatter.php b/src/ApiDomain/External/User/src/Create/CreateResponseFormatter.php new file mode 100644 index 0000000..cb8425c --- /dev/null +++ b/src/ApiDomain/External/User/src/Create/CreateResponseFormatter.php @@ -0,0 +1,30 @@ +getUser(); + + $permissions = []; + foreach ($user->getRole()->getPermissions()->toArray() as $permission) { + $permissions[] = $permission->getIdentifier(); + } + + return [ + 'id' => $user->getId()->toString(), + 'username' => $user->getUsername(), + 'role' => $user->getRole()->getIdentifier(), + 'permissions' => $permissions, + 'created' => $user->getCreatedAt()->format(DateTimeInterface::RFC3339), + 'updated' => $user->getUpdatedAt()->format(DateTimeInterface::RFC3339) + ]; + } +} \ No newline at end of file diff --git a/src/ApiDomain/External/User/src/Formatter/UserFormatter.php b/src/ApiDomain/External/User/src/Formatter/UserFormatter.php deleted file mode 100644 index 920c57c..0000000 --- a/src/ApiDomain/External/User/src/Formatter/UserFormatter.php +++ /dev/null @@ -1,27 +0,0 @@ - $user->getId()->toString(), - 'username' => $user->getUsername(), - 'role' => $user->getRole()->getIdentifier(), - 'created' => $user->getCreatedAt()->format(DateTime::ATOM), - 'updated' => $user->getUpdatedAt()->format(DateTime::ATOM) - ]; - - $userArray['permissions'] = []; - - foreach ($user->getRole()->getPermissions()->toArray() as $permission) { - $userArray['permissions'][] = $permission->getIdentifier(); - } - - return $userArray; - } -} diff --git a/src/ApiDomain/External/User/src/Handler/ChangePasswordHandler.php b/src/ApiDomain/External/User/src/Handler/ChangePasswordHandler.php deleted file mode 100644 index f4d4062..0000000 --- a/src/ApiDomain/External/User/src/Handler/ChangePasswordHandler.php +++ /dev/null @@ -1,43 +0,0 @@ -getAttribute(LoggedInUserMiddleware::USER_KEY); - - $data = json_decode( - $request->getBody()->getContents(), - true - ); - - $query = $this->builder->build( - $user, - $data['password'], - $data['newPassword'], - ); - $this->handler->execute($query); - - return new SuccessResponse(); - } -} diff --git a/src/ApiDomain/External/User/src/Handler/ChangeUsernameHandler.php b/src/ApiDomain/External/User/src/Handler/ChangeUsernameHandler.php deleted file mode 100644 index 012bf71..0000000 --- a/src/ApiDomain/External/User/src/Handler/ChangeUsernameHandler.php +++ /dev/null @@ -1,43 +0,0 @@ -getAttribute(LoggedInUserMiddleware::USER_KEY); - - $data = json_decode( - $request->getBody()->getContents(), - true - ); - - $query = $this->builder->build( - $user, - $data['password'], - $data['newUsername'], - ); - $this->handler->execute($query); - - return new SuccessResponse(); - } -} diff --git a/src/ApiDomain/External/User/src/Handler/CreateUserHandler.php b/src/ApiDomain/External/User/src/Handler/CreateUserHandler.php deleted file mode 100644 index 5096705..0000000 --- a/src/ApiDomain/External/User/src/Handler/CreateUserHandler.php +++ /dev/null @@ -1,44 +0,0 @@ -getBody()->getContents(), - true - ); - - $query = $this->builder->build( - $data['username'], - $data['mail'], - $data['password'], - ); - $result = $this->handler->execute($query); - - return new JsonResponse( - $this->userFormatter->format($result) - ); - } -} - -?> \ No newline at end of file diff --git a/src/ApiDomain/External/User/src/Handler/UserStateHandler.php b/src/ApiDomain/External/User/src/Handler/UserStateHandler.php deleted file mode 100644 index 02bd37b..0000000 --- a/src/ApiDomain/External/User/src/Handler/UserStateHandler.php +++ /dev/null @@ -1,34 +0,0 @@ -getAttribute(LoggedInUserMiddleware::USER_KEY); - - $response = $this->userFormatter->format($user); - $response['sessionId'] = $user->getSession()->getId()->toString(); - - return new JsonResponse($response); - } -} diff --git a/src/ApiDomain/External/User/src/ReadList/ReadListRequestHandler.php b/src/ApiDomain/External/User/src/ReadList/ReadListRequestHandler.php new file mode 100644 index 0000000..d368465 --- /dev/null +++ b/src/ApiDomain/External/User/src/ReadList/ReadListRequestHandler.php @@ -0,0 +1,39 @@ +getAttribute(AnalyzeBodyMiddleware::JSON_DATA); + + $useCase = $this->builder->build( + $data['page'], + $data['perPage'], + $data['query'], + ); + $result = $this->handler->handle($useCase); + + $response = $this->responseFormatter->format($result); + return new SuccessResponse($response); + } +} \ No newline at end of file diff --git a/src/ApiDomain/External/User/src/ReadList/ReadListResponseFormatter.php b/src/ApiDomain/External/User/src/ReadList/ReadListResponseFormatter.php new file mode 100644 index 0000000..0b7a003 --- /dev/null +++ b/src/ApiDomain/External/User/src/ReadList/ReadListResponseFormatter.php @@ -0,0 +1,18 @@ + , + 'items' => , + ]; + } +} \ No newline at end of file diff --git a/src/ApiDomain/External/User/src/State/StateRequestHandler.php b/src/ApiDomain/External/User/src/State/StateRequestHandler.php new file mode 100644 index 0000000..34fe9d0 --- /dev/null +++ b/src/ApiDomain/External/User/src/State/StateRequestHandler.php @@ -0,0 +1,29 @@ +getAttribute(LoggedInUserMiddleware::USER_KEY); + + $response = $this->responseFormatter->format($user); + return new SuccessResponse($response); + } +} \ No newline at end of file diff --git a/src/ApiDomain/External/User/src/State/StateResponseFormatter.php b/src/ApiDomain/External/User/src/State/StateResponseFormatter.php new file mode 100644 index 0000000..00fd48b --- /dev/null +++ b/src/ApiDomain/External/User/src/State/StateResponseFormatter.php @@ -0,0 +1,29 @@ +getRole()->getPermissions()->toArray() as $permission) { + $permissions[] = $permission->getIdentifier(); + } + + return [ + 'id' => $user->getId(), + 'sessionId' => $user->getSession()->getId(), + 'username' => $user->getUsername(), + 'roleIdentifier' => $user->getRole()->getIdentifier(), + 'permissions' => $permissions, + 'createdAt' => $user->getCreatedAt()->format(DateTimeInterface::RFC3339), + 'updatedAt' => $user->getUpdatedAt()->format(DateTimeInterface::RFC3339), + ]; + } +} \ No newline at end of file diff --git a/src/ApiDomain/Schema/External/User/UserState/response.json b/src/ApiDomain/Schema/External/User/UserState/response.json index df4b839..a06e6c0 100644 --- a/src/ApiDomain/Schema/External/User/UserState/response.json +++ b/src/ApiDomain/Schema/External/User/UserState/response.json @@ -20,7 +20,7 @@ "username": { "$ref": "../../Authentication/Partials/username.json" }, - "role": { + "roleIdentifier": { "$ref": "../../Authentication/Partials/role-identifier.json" }, "permissions": { diff --git a/src/HandlingDomain/Authentication/config/service_manager.php b/src/HandlingDomain/Authentication/config/service_manager.php new file mode 100644 index 0000000..8497975 --- /dev/null +++ b/src/HandlingDomain/Authentication/config/service_manager.php @@ -0,0 +1,41 @@ + [ + /// Builder + UserSessionBuilder::class => AutoWiringFactory::class, + + /// Rule + UserPasswordMatchesRule::class => AutoWiringFactory::class, + + /// LoginUser + LoginUserUseCaseHandler::class => InjectionFactory::class, + LoginUserUseCaseBuilder::class => AutoWiringFactory::class, + /// LogoutUser + LogoutUserUseCaseHandler::class => AutoWiringFactory::class, + LogoutUserUseCaseBuilder::class => AutoWiringFactory::class, + /// ForgotPassword + ForgotPasswordUseCaseHandler::class => AutoWiringFactory::class, + ForgotPasswordUseCaseBuilder::class => AutoWiringFactory::class, + /// ResetPassword + ResetPasswordUseCaseHandler::class => AutoWiringFactory::class, + ResetPasswordUseCaseBuilder::class => AutoWiringFactory::class, + ] +]; diff --git a/src/HandlingDomain/UserSession/src/Builder/UserSessionBuilder.php b/src/HandlingDomain/Authentication/src/Builder/UserSessionBuilder.php similarity index 82% rename from src/HandlingDomain/UserSession/src/Builder/UserSessionBuilder.php rename to src/HandlingDomain/Authentication/src/Builder/UserSessionBuilder.php index 7c1df62..28fc6d8 100644 --- a/src/HandlingDomain/UserSession/src/Builder/UserSessionBuilder.php +++ b/src/HandlingDomain/Authentication/src/Builder/UserSessionBuilder.php @@ -1,6 +1,6 @@ require __DIR__ . '/./../config/service_manager.php', + ]; + } +} \ No newline at end of file diff --git a/src/HandlingDomain/UserSession/src/Rule/UserPasswordMatchesRule.php b/src/HandlingDomain/Authentication/src/Rule/UserPasswordMatchesRule.php similarity index 90% rename from src/HandlingDomain/UserSession/src/Rule/UserPasswordMatchesRule.php rename to src/HandlingDomain/Authentication/src/Rule/UserPasswordMatchesRule.php index 6ea7280..a0079d2 100644 --- a/src/HandlingDomain/UserSession/src/Rule/UserPasswordMatchesRule.php +++ b/src/HandlingDomain/Authentication/src/Rule/UserPasswordMatchesRule.php @@ -1,6 +1,6 @@ mail; + } +} \ No newline at end of file diff --git a/src/HandlingDomain/Authentication/src/UseCase/ForgotPassword/ForgotPasswordUseCaseBuilder.php b/src/HandlingDomain/Authentication/src/UseCase/ForgotPassword/ForgotPasswordUseCaseBuilder.php new file mode 100644 index 0000000..eaff05a --- /dev/null +++ b/src/HandlingDomain/Authentication/src/UseCase/ForgotPassword/ForgotPasswordUseCaseBuilder.php @@ -0,0 +1,16 @@ +session; + } + + public function getIdentifier(): string + { + return $this->identifier; + } + + public function getPassword(): string + { + return $this->password; + } +} \ No newline at end of file diff --git a/src/HandlingDomain/Authentication/src/UseCase/LoginUser/LoginUserUseCaseBuilder.php b/src/HandlingDomain/Authentication/src/UseCase/LoginUser/LoginUserUseCaseBuilder.php new file mode 100644 index 0000000..369e40a --- /dev/null +++ b/src/HandlingDomain/Authentication/src/UseCase/LoginUser/LoginUserUseCaseBuilder.php @@ -0,0 +1,22 @@ +userRepository->findByIdentifier( - $command->getIdentifier() - ); - - if ($user === null) { - throw new UserNotFoundByIdentifierException($command->getIdentifier()); - } - - if ( - !$this->passwordMatchesRule->appliesTo( - $command->getPassword(), - $user - ) - ) { - throw new UserWrongPasswordException(); - } - - $oldUserSessions = $this->userSessionRepository->findBy([ - 'userId' => $user->getId() - ]); - - foreach ($oldUserSessions as $oldUserSession) { - $this->entityManager->remove($oldUserSession); - } - - $session = $command->getSession(); - $session->setUser($user); - $user->setLastLoginAt(new DateTime('now')); - - $this->entityManager->persist($session); - $this->entityManager->flush(); - - return $session; - } -} - -?> \ No newline at end of file +userRepository->findByIdentifier($useCase->getIdentifier()); + + if ($user === null) { + throw new UserNotFoundByIdentifierException($useCase->getIdentifier()); + } + + if (!$this->passwordMatchesRule->appliesTo($useCase->getPassword(), $user)) { + throw new UserWrongPasswordException(); + } + + $oldUserSessions = $this->userSessionRepository->findBy(['userId' => $user->getId()]); + + foreach ($oldUserSessions as $oldUserSession) { + $this->entityManager->remove($oldUserSession); + } + + $session = $useCase->getSession(); + $session->setUser($user); + $user->setLastLoginAt(new DateTime('now')); + + $this->entityManager->persist($session); + $this->entityManager->flush(); + + return new LoginUserUseCaseResult($session); + } +} \ No newline at end of file diff --git a/src/HandlingDomain/Authentication/src/UseCase/LoginUser/LoginUserUseCaseResult.php b/src/HandlingDomain/Authentication/src/UseCase/LoginUser/LoginUserUseCaseResult.php new file mode 100644 index 0000000..7fb066e --- /dev/null +++ b/src/HandlingDomain/Authentication/src/UseCase/LoginUser/LoginUserUseCaseResult.php @@ -0,0 +1,20 @@ +userSession; + } +} \ No newline at end of file diff --git a/src/HandlingDomain/Authentication/src/UseCase/LogoutUser/LogoutUserUseCase.php b/src/HandlingDomain/Authentication/src/UseCase/LogoutUser/LogoutUserUseCase.php new file mode 100644 index 0000000..efa82ca --- /dev/null +++ b/src/HandlingDomain/Authentication/src/UseCase/LogoutUser/LogoutUserUseCase.php @@ -0,0 +1,20 @@ +userSession; + } +} \ No newline at end of file diff --git a/src/HandlingDomain/Authentication/src/UseCase/LogoutUser/LogoutUserUseCaseBuilder.php b/src/HandlingDomain/Authentication/src/UseCase/LogoutUser/LogoutUserUseCaseBuilder.php new file mode 100644 index 0000000..359462a --- /dev/null +++ b/src/HandlingDomain/Authentication/src/UseCase/LogoutUser/LogoutUserUseCaseBuilder.php @@ -0,0 +1,18 @@ +getSession(); + + $this->entityManager->remove($session); + $this->entityManager->flush(); + + return new LogoutUserUseCaseResult($session); + } +} \ No newline at end of file diff --git a/src/HandlingDomain/Authentication/src/UseCase/LogoutUser/LogoutUserUseCaseResult.php b/src/HandlingDomain/Authentication/src/UseCase/LogoutUser/LogoutUserUseCaseResult.php new file mode 100644 index 0000000..fc9ad68 --- /dev/null +++ b/src/HandlingDomain/Authentication/src/UseCase/LogoutUser/LogoutUserUseCaseResult.php @@ -0,0 +1,12 @@ +passwordToken; + } + + public function getNewPassword(): string + { + return $this->newPassword; + } + + public function getPasswordConfirmation(): string + { + return $this->passwordConfirmation; + } +} \ No newline at end of file diff --git a/src/HandlingDomain/Authentication/src/UseCase/ResetPassword/ResetPasswordUseCaseBuilder.php b/src/HandlingDomain/Authentication/src/UseCase/ResetPassword/ResetPasswordUseCaseBuilder.php new file mode 100644 index 0000000..cca425c --- /dev/null +++ b/src/HandlingDomain/Authentication/src/UseCase/ResetPassword/ResetPasswordUseCaseBuilder.php @@ -0,0 +1,22 @@ + AutoWiringFactory::class, /// CQRS - // Register User - RegisterUserCommandHandler::class => AutoWiringFactory::class, - RegisterUserCommandBuilder::class => AutoWiringFactory::class, - - // Confirm Registration - ConfirmRegistrationCommandHandler::class => AutoWiringFactory::class, - ConfirmRegistrationCommandBuilder::class => AutoWiringFactory::class, + /// ConfirmRegistration + ConfirmRegistrationUseCaseHandler::class => AutoWiringFactory::class, + ConfirmRegistrationUseCaseBuilder::class => AutoWiringFactory::class, + /// RegisterUser + RegisterUserUseCaseHandler::class => AutoWiringFactory::class, + RegisterUserUseCaseBuilder::class => AutoWiringFactory::class, ], ]; diff --git a/src/HandlingDomain/Registration/src/Exception/RegistrationNotFoundByIdException.php b/src/HandlingDomain/Registration/src/Exception/RegistrationNotFoundByIdException.php index e1f9ba7..cff982b 100644 --- a/src/HandlingDomain/Registration/src/Exception/RegistrationNotFoundByIdException.php +++ b/src/HandlingDomain/Registration/src/Exception/RegistrationNotFoundByIdException.php @@ -4,10 +4,10 @@ namespace Template\Handling\Registration\Exception; use Template\Infrastructure\Exception\ErrorCode; use Template\Infrastructure\Exception\ErrorDomain; -use Template\Infrastructure\Exception\Exception\Exception; +use Template\Infrastructure\Exception\Exception\TemplateException; use Ramsey\Uuid\UuidInterface; -class RegistrationNotFoundByIdException extends Exception +class RegistrationNotFoundByIdException extends TemplateException { private const MESSAGE = 'A Registration with the id %s was not be found!'; public function __construct( diff --git a/src/HandlingDomain/Registration/src/Exception/RegistrationWithIdentifierAlreadyExistsException.php b/src/HandlingDomain/Registration/src/Exception/RegistrationWithIdentifierAlreadyExistsException.php index c86afc5..e66bea3 100644 --- a/src/HandlingDomain/Registration/src/Exception/RegistrationWithIdentifierAlreadyExistsException.php +++ b/src/HandlingDomain/Registration/src/Exception/RegistrationWithIdentifierAlreadyExistsException.php @@ -4,9 +4,9 @@ namespace Template\Handling\Registration\Exception; use Template\Infrastructure\Exception\ErrorCode; use Template\Infrastructure\Exception\ErrorDomain; -use Template\Infrastructure\Exception\Exception\Exception; +use Template\Infrastructure\Exception\Exception\TemplateException; -class RegistrationWithIdentifierAlreadyExistsException extends Exception +class RegistrationWithIdentifierAlreadyExistsException extends TemplateException { private const MESSAGE = 'A Registration with the identifier %s does already exist!'; diff --git a/src/HandlingDomain/Registration/src/Handler/Command/ConfirmRegistration/ConfirmRegistrationCommand.php b/src/HandlingDomain/Registration/src/Handler/Command/ConfirmRegistration/ConfirmRegistrationCommand.php deleted file mode 100644 index 5518bb5..0000000 --- a/src/HandlingDomain/Registration/src/Handler/Command/ConfirmRegistration/ConfirmRegistrationCommand.php +++ /dev/null @@ -1,28 +0,0 @@ -id; - } - - public function getPassword(): string { - return $this->password; - } - - - public function getPasswordConfirmation(): string { - return $this->passwordConfirmation; - } -} diff --git a/src/HandlingDomain/Registration/src/Handler/Command/ConfirmRegistration/ConfirmRegistrationCommandBuilder.php b/src/HandlingDomain/Registration/src/Handler/Command/ConfirmRegistration/ConfirmRegistrationCommandBuilder.php deleted file mode 100644 index 4c3d0c3..0000000 --- a/src/HandlingDomain/Registration/src/Handler/Command/ConfirmRegistration/ConfirmRegistrationCommandBuilder.php +++ /dev/null @@ -1,21 +0,0 @@ -pipeline->handle($payload); - - return $payload->getUser(); - } -} diff --git a/src/HandlingDomain/Registration/src/Handler/Command/RegisterUser/RegisterUserCommand.php b/src/HandlingDomain/Registration/src/Handler/Command/RegisterUser/RegisterUserCommand.php deleted file mode 100644 index dae1cde..0000000 --- a/src/HandlingDomain/Registration/src/Handler/Command/RegisterUser/RegisterUserCommand.php +++ /dev/null @@ -1,25 +0,0 @@ -username; - } - - public function getMail(): string { - return $this->mail; - } - - public function getHost(): string { - return $this->host; - } -} diff --git a/src/HandlingDomain/Registration/src/Handler/Command/RegisterUser/RegisterUserCommandBuilder.php b/src/HandlingDomain/Registration/src/Handler/Command/RegisterUser/RegisterUserCommandBuilder.php deleted file mode 100644 index 45122cf..0000000 --- a/src/HandlingDomain/Registration/src/Handler/Command/RegisterUser/RegisterUserCommandBuilder.php +++ /dev/null @@ -1,19 +0,0 @@ -pipeline->handle($payload); - - return $payload->getRegistration(); - } -} diff --git a/src/HandlingDomain/Registration/src/Pipeline/ConfirmRegistration/ConfirmRegistrationPayload.php b/src/HandlingDomain/Registration/src/Pipeline/ConfirmRegistration/ConfirmRegistrationPayload.php index f43c99b..44a9640 100644 --- a/src/HandlingDomain/Registration/src/Pipeline/ConfirmRegistration/ConfirmRegistrationPayload.php +++ b/src/HandlingDomain/Registration/src/Pipeline/ConfirmRegistration/ConfirmRegistrationPayload.php @@ -8,6 +8,7 @@ use Template\Data\Business\Entity\Registration; use Template\Data\Business\Entity\User; use Template\Handling\Registration\Handler\Command\ConfirmRegistration\ConfirmRegistrationCommand; use Template\Handling\Registration\Handler\Command\RegisterUser\RegisterUserCommand; +use Template\Handling\Registration\UseCase\ConfirmRegistration\ConfirmRegistrationUseCase; class ConfirmRegistrationPayload { @@ -15,11 +16,11 @@ class ConfirmRegistrationPayload private readonly ?User $user; public function __construct( - private readonly ConfirmRegistrationCommand $command + private readonly ConfirmRegistrationUseCase $command ) { } - public function getCommand(): ConfirmRegistrationCommand + public function getUseCase(): ConfirmRegistrationUseCase { return $this->command; } diff --git a/src/HandlingDomain/Registration/src/Pipeline/ConfirmRegistration/Step/CreateUserStep.php b/src/HandlingDomain/Registration/src/Pipeline/ConfirmRegistration/Step/CreateUserStep.php index 00f9ad4..11f988a 100644 --- a/src/HandlingDomain/Registration/src/Pipeline/ConfirmRegistration/Step/CreateUserStep.php +++ b/src/HandlingDomain/Registration/src/Pipeline/ConfirmRegistration/Step/CreateUserStep.php @@ -33,14 +33,14 @@ class CreateUserStep implements TaskInterface PipelineInterface $pipeline ): void { - /** @var ConfirmRegistrationCommand $command */ - $command = $payload->getCommand(); + /** @var ConfirmRegistrationCommand $useCase */ + $useCase = $payload->getUseCase(); $registration = $payload->getRegistration(); if ( !$this->passwordMatchRule->appliesTo( - $command->getPassword(), - $command->getPasswordConfirmation() + $useCase->getPassword(), + $useCase->getPasswordConfirmation() ) ) { throw new UserPasswordMismatchException(); @@ -49,7 +49,7 @@ class CreateUserStep implements TaskInterface $createUserCommand = $this->createUserCommandBuilder->build( username: $registration->getUsername(), mail: $registration->getMail(), - password: $command->getPassword(), + password: $useCase->getPassword(), ); $user = $this->createUserCommandHandler->execute($createUserCommand); diff --git a/src/HandlingDomain/Registration/src/Pipeline/ConfirmRegistration/Step/LoadRegistrationStep.php b/src/HandlingDomain/Registration/src/Pipeline/ConfirmRegistration/Step/LoadRegistrationStep.php index 0452172..4cddec5 100644 --- a/src/HandlingDomain/Registration/src/Pipeline/ConfirmRegistration/Step/LoadRegistrationStep.php +++ b/src/HandlingDomain/Registration/src/Pipeline/ConfirmRegistration/Step/LoadRegistrationStep.php @@ -24,20 +24,23 @@ class LoadRegistrationStep implements TaskInterface ) { } + /** + * @throws RegistrationNotFoundByIdException + */ public function __invoke( $payload, PipelineInterface $pipeline ) { - $command = $payload->getCommand(); + $useCase = $payload->getUseCase(); /** @var Registration $registration */ $registration = $this->registrationRepository->findOneBy([ - 'id' => $command->getId() + 'id' => $useCase->getId() ]) ?? null; if ($registration === null) { - throw new RegistrationNotFoundByIdException($command->getId()); + throw new RegistrationNotFoundByIdException($useCase->getId()); } $payload->setRegistration($registration); diff --git a/src/HandlingDomain/Registration/src/Pipeline/RegisterUser/RegisterUserPayload.php b/src/HandlingDomain/Registration/src/Pipeline/RegisterUser/RegisterUserPayload.php index 389bf91..3cdb476 100644 --- a/src/HandlingDomain/Registration/src/Pipeline/RegisterUser/RegisterUserPayload.php +++ b/src/HandlingDomain/Registration/src/Pipeline/RegisterUser/RegisterUserPayload.php @@ -6,19 +6,20 @@ namespace Template\Handling\Registration\Pipeline\RegisterUser; use Template\Data\Business\Entity\Registration; use Template\Handling\Registration\Handler\Command\RegisterUser\RegisterUserCommand; +use Template\Handling\Registration\UseCase\RegisterUser\RegisterUserUseCase; class RegisterUserPayload { private readonly ?Registration $registration; public function __construct( - private readonly RegisterUserCommand $command + private readonly RegisterUserUseCase $useCase, ) { } - public function getCommand(): RegisterUserCommand + public function getUseCase(): RegisterUserUseCase { - return $this->command; + return $this->useCase; } public function getRegistration(): ?Registration diff --git a/src/HandlingDomain/Registration/src/Pipeline/RegisterUser/Step/BuildRegistrationStep.php b/src/HandlingDomain/Registration/src/Pipeline/RegisterUser/Step/BuildRegistrationStep.php index 8ac652f..ba96a53 100644 --- a/src/HandlingDomain/Registration/src/Pipeline/RegisterUser/Step/BuildRegistrationStep.php +++ b/src/HandlingDomain/Registration/src/Pipeline/RegisterUser/Step/BuildRegistrationStep.php @@ -20,11 +20,11 @@ class BuildRegistrationStep implements TaskInterface PipelineInterface $pipeline ) { - $command = $payload->getCommand(); + $useCase = $payload->getUseCase(); $registration = $this->builder->build( - username: $command->getUsername(), - mail: $command->getMail() + username: $useCase->getUsername(), + mail: $useCase->getMail() ); $payload->setRegistration($registration); diff --git a/src/HandlingDomain/Registration/src/Pipeline/RegisterUser/Step/CheckIdentifierStep.php b/src/HandlingDomain/Registration/src/Pipeline/RegisterUser/Step/CheckIdentifierStep.php index cab145f..6d71ea3 100644 --- a/src/HandlingDomain/Registration/src/Pipeline/RegisterUser/Step/CheckIdentifierStep.php +++ b/src/HandlingDomain/Registration/src/Pipeline/RegisterUser/Step/CheckIdentifierStep.php @@ -28,13 +28,13 @@ class CheckIdentifierStep implements TaskInterface PipelineInterface $pipeline ) { - $command = $payload->getCommand(); + $useCase = $payload->getUseCase(); - $this->userWithIdentifierAlreadyExistsRule->appliesTo($command->getMail()); - $this->userWithIdentifierAlreadyExistsRule->appliesTo($command->getUsername()); + $this->userWithIdentifierAlreadyExistsRule->appliesTo($useCase->getMail()); + $this->userWithIdentifierAlreadyExistsRule->appliesTo($useCase->getUsername()); - $this->registrationWithIdentifierAlreadyExistsRule->appliesTo($command->getMail()); - $this->registrationWithIdentifierAlreadyExistsRule->appliesTo($command->getUsername()); + $this->registrationWithIdentifierAlreadyExistsRule->appliesTo($useCase->getMail()); + $this->registrationWithIdentifierAlreadyExistsRule->appliesTo($useCase->getUsername()); $pipeline->next()($payload, $pipeline); } diff --git a/src/HandlingDomain/Registration/src/Pipeline/RegisterUser/Step/SendMailStep.php b/src/HandlingDomain/Registration/src/Pipeline/RegisterUser/Step/SendMailStep.php index aef6cc2..fa14759 100644 --- a/src/HandlingDomain/Registration/src/Pipeline/RegisterUser/Step/SendMailStep.php +++ b/src/HandlingDomain/Registration/src/Pipeline/RegisterUser/Step/SendMailStep.php @@ -22,7 +22,7 @@ class SendMailStep implements TaskInterface PipelineInterface $pipeline ) { - $command = $payload->getCommand(); + $useCase = $payload->getUseCase(); $registration = $payload->getRegistration(); $this->requestService->request( @@ -31,13 +31,13 @@ class SendMailStep implements TaskInterface [ 'template-identifier' => 'new-account', 'sender' => 'info@stack-up.de', - 'recipient' => $command->getMail(), + 'recipient' => $useCase->getMail(), 'data' => [ - 'username' => $command->getUsername(), + 'username' => $useCase->getUsername(), 'confirmationLink' => sprintf( self::CONFIRM_LINK, - $command->getHost(), + $useCase->getHost(), $registration->getId()->toString() ) ] diff --git a/src/HandlingDomain/Registration/src/UseCase/ConfirmRegistration/ConfirmRegistrationUseCase.php b/src/HandlingDomain/Registration/src/UseCase/ConfirmRegistration/ConfirmRegistrationUseCase.php new file mode 100644 index 0000000..20387a3 --- /dev/null +++ b/src/HandlingDomain/Registration/src/UseCase/ConfirmRegistration/ConfirmRegistrationUseCase.php @@ -0,0 +1,32 @@ +id; + } + + public function getPassword(): string + { + return $this->password; + } + + public function getPasswordConfirmation(): string + { + return $this->passwordConfirmation; + } +} \ No newline at end of file diff --git a/src/HandlingDomain/Registration/src/UseCase/ConfirmRegistration/ConfirmRegistrationUseCaseBuilder.php b/src/HandlingDomain/Registration/src/UseCase/ConfirmRegistration/ConfirmRegistrationUseCaseBuilder.php new file mode 100644 index 0000000..b71d832 --- /dev/null +++ b/src/HandlingDomain/Registration/src/UseCase/ConfirmRegistration/ConfirmRegistrationUseCaseBuilder.php @@ -0,0 +1,22 @@ +pipeline->handle($payload); + + return new ConfirmRegistrationUseCaseResult($payload->getUser()); + } +} \ No newline at end of file diff --git a/src/HandlingDomain/Registration/src/UseCase/ConfirmRegistration/ConfirmRegistrationUseCaseResult.php b/src/HandlingDomain/Registration/src/UseCase/ConfirmRegistration/ConfirmRegistrationUseCaseResult.php new file mode 100644 index 0000000..88c8d8e --- /dev/null +++ b/src/HandlingDomain/Registration/src/UseCase/ConfirmRegistration/ConfirmRegistrationUseCaseResult.php @@ -0,0 +1,20 @@ +user; + } +} \ No newline at end of file diff --git a/src/HandlingDomain/Registration/src/UseCase/RegisterUser/RegisterUserUseCase.php b/src/HandlingDomain/Registration/src/UseCase/RegisterUser/RegisterUserUseCase.php new file mode 100644 index 0000000..93d4a10 --- /dev/null +++ b/src/HandlingDomain/Registration/src/UseCase/RegisterUser/RegisterUserUseCase.php @@ -0,0 +1,24 @@ +username; + } + + public function getMail(): string + { + return $this->mail; + } +} \ No newline at end of file diff --git a/src/HandlingDomain/Registration/src/UseCase/RegisterUser/RegisterUserUseCaseBuilder.php b/src/HandlingDomain/Registration/src/UseCase/RegisterUser/RegisterUserUseCaseBuilder.php new file mode 100644 index 0000000..aa0c787 --- /dev/null +++ b/src/HandlingDomain/Registration/src/UseCase/RegisterUser/RegisterUserUseCaseBuilder.php @@ -0,0 +1,18 @@ +pipeline->handle($payload); + + return new RegisterUserUseCaseResult($payload->getRegistration()); + } +} \ No newline at end of file diff --git a/src/HandlingDomain/Registration/src/UseCase/RegisterUser/RegisterUserUseCaseResult.php b/src/HandlingDomain/Registration/src/UseCase/RegisterUser/RegisterUserUseCaseResult.php new file mode 100644 index 0000000..6321720 --- /dev/null +++ b/src/HandlingDomain/Registration/src/UseCase/RegisterUser/RegisterUserUseCaseResult.php @@ -0,0 +1,20 @@ +registration; + } +} \ No newline at end of file diff --git a/src/HandlingDomain/User/config/service_manager.php b/src/HandlingDomain/User/config/service_manager.php index df28afb..73950b4 100644 --- a/src/HandlingDomain/User/config/service_manager.php +++ b/src/HandlingDomain/User/config/service_manager.php @@ -1,12 +1,14 @@ AutoWiringFactory::class, /// CQRS - // Create User - CreateUserCommandHandler::class => AutoWiringFactory::class, - CreateUserCommandBuilder::class => AutoWiringFactory::class, - - // Change Password - ChangePasswordCommandHandler::class => AutoWiringFactory::class, - ChangePasswordCommandBuilder::class => AutoWiringFactory::class, - - // Change Username - ChangeUsernameCommandHandler::class => AutoWiringFactory::class, - ChangeUsernameCommandBuilder::class => AutoWiringFactory::class, + /// Create + CreateUseCaseHandler::class => AutoWiringFactory::class, + CreateUseCaseBuilder::class => AutoWiringFactory::class, + /// ChangePassword + ChangePasswordUseCaseHandler::class => AutoWiringFactory::class, + ChangePasswordUseCaseBuilder::class => AutoWiringFactory::class, + /// ChangeUsername + ChangeUsernameUseCaseHandler::class => AutoWiringFactory::class, + ChangeUsernameUseCaseBuilder::class => AutoWiringFactory::class, + /// ReadList + ReadListUseCaseHandler::class => AutoWiringFactory::class, + ReadListUseCaseBuilder::class => AutoWiringFactory::class, ], ]; diff --git a/src/HandlingDomain/User/src/Builder/UserBuilder.php b/src/HandlingDomain/User/src/Builder/UserBuilder.php index a5c6f5b..7d558f8 100644 --- a/src/HandlingDomain/User/src/Builder/UserBuilder.php +++ b/src/HandlingDomain/User/src/Builder/UserBuilder.php @@ -5,10 +5,10 @@ namespace Template\Handling\User\Builder; use Template\Data\Business\Entity\Role; use Template\Data\Business\Entity\User; use Template\Data\Business\Repository\RoleRepository; -use Template\Handling\Role\Exception\RoleNotFoundByIdentifierException; use Template\Infrastructure\Encryption\Client\EncryptionClient; use Reinfi\DependencyInjection\Annotation\Inject; use Reinfi\DependencyInjection\Annotation\InjectDoctrineRepository; +use Template\Infrastructure\Rbac\Exception\RoleNotFoundByIdentifierException; class UserBuilder { diff --git a/src/HandlingDomain/User/src/Exception/UserNotFoundByIdentifierException.php b/src/HandlingDomain/User/src/Exception/UserNotFoundByIdentifierException.php index 09e56f0..c167f1a 100644 --- a/src/HandlingDomain/User/src/Exception/UserNotFoundByIdentifierException.php +++ b/src/HandlingDomain/User/src/Exception/UserNotFoundByIdentifierException.php @@ -4,9 +4,9 @@ namespace Template\Handling\User\Exception; use Template\Infrastructure\Exception\ErrorCode; use Template\Infrastructure\Exception\ErrorDomain; -use Template\Infrastructure\Exception\Exception\Exception; +use Template\Infrastructure\Exception\Exception\TemplateException; -class UserNotFoundByIdentifierException extends Exception { +class UserNotFoundByIdentifierException extends TemplateException { private const MESSAGE = 'The user with the Identifier %s was not found!'; @@ -21,6 +21,4 @@ class UserNotFoundByIdentifierException extends Exception { ErrorCode::NotFound ); } -} - -?> \ No newline at end of file +} \ No newline at end of file diff --git a/src/HandlingDomain/User/src/Exception/UserPasswordMismatchException.php b/src/HandlingDomain/User/src/Exception/UserPasswordMismatchException.php index 844e2c7..572936a 100644 --- a/src/HandlingDomain/User/src/Exception/UserPasswordMismatchException.php +++ b/src/HandlingDomain/User/src/Exception/UserPasswordMismatchException.php @@ -4,9 +4,9 @@ namespace Template\Handling\User\Exception; use Template\Infrastructure\Exception\ErrorCode; use Template\Infrastructure\Exception\ErrorDomain; -use Template\Infrastructure\Exception\Exception\Exception; +use Template\Infrastructure\Exception\Exception\TemplateException; -class UserPasswordMismatchException extends Exception { +class UserPasswordMismatchException extends TemplateException { private const MESSAGE = 'The two passwords do not match!'; diff --git a/src/HandlingDomain/User/src/Exception/UserWithIdentifierAlreadyExistsException.php b/src/HandlingDomain/User/src/Exception/UserWithIdentifierAlreadyExistsException.php index 28d4767..d33ccdd 100644 --- a/src/HandlingDomain/User/src/Exception/UserWithIdentifierAlreadyExistsException.php +++ b/src/HandlingDomain/User/src/Exception/UserWithIdentifierAlreadyExistsException.php @@ -4,9 +4,9 @@ namespace Template\Handling\User\Exception; use Template\Infrastructure\Exception\ErrorCode; use Template\Infrastructure\Exception\ErrorDomain; -use Template\Infrastructure\Exception\Exception\Exception; +use Template\Infrastructure\Exception\Exception\TemplateException; -class UserWithIdentifierAlreadyExistsException extends Exception { +class UserWithIdentifierAlreadyExistsException extends TemplateException { private const MESSAGE = 'A User with the identifier %s does already exist!'; diff --git a/src/HandlingDomain/User/src/Exception/UserWrongPasswordException.php b/src/HandlingDomain/User/src/Exception/UserWrongPasswordException.php index 3cbe5be..1109357 100644 --- a/src/HandlingDomain/User/src/Exception/UserWrongPasswordException.php +++ b/src/HandlingDomain/User/src/Exception/UserWrongPasswordException.php @@ -4,9 +4,9 @@ namespace Template\Handling\User\Exception; use Template\Infrastructure\Exception\ErrorCode; use Template\Infrastructure\Exception\ErrorDomain; -use Template\Infrastructure\Exception\Exception\Exception; +use Template\Infrastructure\Exception\Exception\TemplateException; -class UserWrongPasswordException extends Exception { +class UserWrongPasswordException extends TemplateException { private const MESSAGE = 'The given password is incorrect!'; diff --git a/src/HandlingDomain/User/src/Handler/Command/ChangePassword/ChangePasswordCommand.php b/src/HandlingDomain/User/src/Handler/Command/ChangePassword/ChangePasswordCommand.php deleted file mode 100644 index 4c7d472..0000000 --- a/src/HandlingDomain/User/src/Handler/Command/ChangePassword/ChangePasswordCommand.php +++ /dev/null @@ -1,27 +0,0 @@ -user; - } - - public function getNewPassword(): string { - return $this->newPassword; - } - - public function getPassword(): string { - return $this->password; - } -} diff --git a/src/HandlingDomain/User/src/Handler/Command/ChangePassword/ChangePasswordCommandBuilder.php b/src/HandlingDomain/User/src/Handler/Command/ChangePassword/ChangePasswordCommandBuilder.php deleted file mode 100644 index 1ac93b8..0000000 --- a/src/HandlingDomain/User/src/Handler/Command/ChangePassword/ChangePasswordCommandBuilder.php +++ /dev/null @@ -1,21 +0,0 @@ -getUser(); - - if (!$this->encryptionClient->verify($command->getPassword(), $user->getPassword())) { - throw new UserWrongPasswordException(); - } - - $encryptedPassword = $this->encryptionClient->encrypt( - $command->getNewPassword() - ); - $user->setPassword($encryptedPassword); - - $this->entityManager->persist($user); - $this->entityManager->flush(); - } -} diff --git a/src/HandlingDomain/User/src/Handler/Command/ChangeUsername/ChangeUsernameCommand.php b/src/HandlingDomain/User/src/Handler/Command/ChangeUsername/ChangeUsernameCommand.php deleted file mode 100644 index 7a9350d..0000000 --- a/src/HandlingDomain/User/src/Handler/Command/ChangeUsername/ChangeUsernameCommand.php +++ /dev/null @@ -1,28 +0,0 @@ -user; - } - - public function getNewUsername(): string { - return $this->newUsername; - } - - public function getPassword(): string { - return $this->password; - } -} - diff --git a/src/HandlingDomain/User/src/Handler/Command/ChangeUsername/ChangeUsernameCommandBuilder.php b/src/HandlingDomain/User/src/Handler/Command/ChangeUsername/ChangeUsernameCommandBuilder.php deleted file mode 100644 index 50e90e9..0000000 --- a/src/HandlingDomain/User/src/Handler/Command/ChangeUsername/ChangeUsernameCommandBuilder.php +++ /dev/null @@ -1,21 +0,0 @@ -getUser(); - - if (!$this->encryptionClient->verify($command->getPassword(), $user->getPassword())) { - throw new UserWrongPasswordException(); - } - - $user->setUsername($command->getNewUsername()); - - $this->entityManager->persist($user); - $this->entityManager->flush(); - } -} diff --git a/src/HandlingDomain/User/src/Handler/Command/CreateUser/CreateUserCommand.php b/src/HandlingDomain/User/src/Handler/Command/CreateUser/CreateUserCommand.php deleted file mode 100644 index 5f42338..0000000 --- a/src/HandlingDomain/User/src/Handler/Command/CreateUser/CreateUserCommand.php +++ /dev/null @@ -1,25 +0,0 @@ -username; - } - - public function getMail(): string { - return $this->mail; - } - - public function getPassword(): string { - return $this->password; - } -} \ No newline at end of file diff --git a/src/HandlingDomain/User/src/Handler/Command/CreateUser/CreateUserCommandBuilder.php b/src/HandlingDomain/User/src/Handler/Command/CreateUser/CreateUserCommandBuilder.php deleted file mode 100644 index eebec74..0000000 --- a/src/HandlingDomain/User/src/Handler/Command/CreateUser/CreateUserCommandBuilder.php +++ /dev/null @@ -1,19 +0,0 @@ -userWithIdentifierAlreadyExistsRule->appliesTo($command->getUsername()); - $this->userWithIdentifierAlreadyExistsRule->appliesTo($command->getMail()); - - $user = $this->builder->build( - username: $command->getUsername(), - roleIdentifier: 'user', - mail: $command->getMail(), - password: $command->getPassword() - ); - - $this->entityManager->persist($user); - $this->entityManager->flush(); - - return $user; - } -} - -?> \ No newline at end of file diff --git a/src/HandlingDomain/User/src/UseCase/ChangePassword/ChangePasswordUseCase.php b/src/HandlingDomain/User/src/UseCase/ChangePassword/ChangePasswordUseCase.php new file mode 100644 index 0000000..0a17e06 --- /dev/null +++ b/src/HandlingDomain/User/src/UseCase/ChangePassword/ChangePasswordUseCase.php @@ -0,0 +1,32 @@ +user; + } + + public function getPassword(): string + { + return $this->password; + } + + public function getNewPassword(): string + { + return $this->newPassword; + } +} \ No newline at end of file diff --git a/src/HandlingDomain/User/src/UseCase/ChangePassword/ChangePasswordUseCaseBuilder.php b/src/HandlingDomain/User/src/UseCase/ChangePassword/ChangePasswordUseCaseBuilder.php new file mode 100644 index 0000000..e8cc12d --- /dev/null +++ b/src/HandlingDomain/User/src/UseCase/ChangePassword/ChangePasswordUseCaseBuilder.php @@ -0,0 +1,22 @@ +getUser(); + + if (!$this->encryptionClient->verify($useCase->getPassword(), $user->getPassword())) { + throw new UserWrongPasswordException(); + } + + $encryptedPassword = $this->encryptionClient->encrypt( + $useCase->getNewPassword() + ); + $user->setPassword($encryptedPassword); + + $this->entityManager->persist($user); + $this->entityManager->flush(); + + return new ChangePasswordUseCaseResult(); + } +} \ No newline at end of file diff --git a/src/HandlingDomain/User/src/UseCase/ChangePassword/ChangePasswordUseCaseResult.php b/src/HandlingDomain/User/src/UseCase/ChangePassword/ChangePasswordUseCaseResult.php new file mode 100644 index 0000000..9ed3d4d --- /dev/null +++ b/src/HandlingDomain/User/src/UseCase/ChangePassword/ChangePasswordUseCaseResult.php @@ -0,0 +1,12 @@ +user; + } + + public function getPassword(): string + { + return $this->password; + } + + public function getNewUsername(): string + { + return $this->newUsername; + } +} \ No newline at end of file diff --git a/src/HandlingDomain/User/src/UseCase/ChangeUsername/ChangeUsernameUseCaseBuilder.php b/src/HandlingDomain/User/src/UseCase/ChangeUsername/ChangeUsernameUseCaseBuilder.php new file mode 100644 index 0000000..05a5abb --- /dev/null +++ b/src/HandlingDomain/User/src/UseCase/ChangeUsername/ChangeUsernameUseCaseBuilder.php @@ -0,0 +1,22 @@ +getUser(); + + if (!$this->encryptionClient->verify($useCase->getPassword(), $user->getPassword())) { + throw new UserWrongPasswordException(); + } + + $user->setUsername($useCase->getNewUsername()); + + $this->entityManager->persist($user); + $this->entityManager->flush(); + + return new ChangeUsernameUseCaseResult(); + } +} \ No newline at end of file diff --git a/src/HandlingDomain/User/src/UseCase/ChangeUsername/ChangeUsernameUseCaseResult.php b/src/HandlingDomain/User/src/UseCase/ChangeUsername/ChangeUsernameUseCaseResult.php new file mode 100644 index 0000000..74d9319 --- /dev/null +++ b/src/HandlingDomain/User/src/UseCase/ChangeUsername/ChangeUsernameUseCaseResult.php @@ -0,0 +1,12 @@ +username; + } + + public function getMail(): string + { + return $this->mail; + } + + public function getPassword(): string + { + return $this->password; + } +} \ No newline at end of file diff --git a/src/HandlingDomain/User/src/UseCase/Create/CreateUseCaseBuilder.php b/src/HandlingDomain/User/src/UseCase/Create/CreateUseCaseBuilder.php new file mode 100644 index 0000000..f8684a5 --- /dev/null +++ b/src/HandlingDomain/User/src/UseCase/Create/CreateUseCaseBuilder.php @@ -0,0 +1,20 @@ +userWithIdentifierAlreadyExistsRule->appliesTo($useCase->getUsername()); + $this->userWithIdentifierAlreadyExistsRule->appliesTo($useCase->getMail()); + + $user = $this->builder->build( + username: $useCase->getUsername(), + roleIdentifier: 'user', + mail: $useCase->getMail(), + password: $useCase->getPassword() + ); + + $this->entityManager->persist($user); + $this->entityManager->flush(); + + return new CreateUseCaseResult($user); + } +} \ No newline at end of file diff --git a/src/HandlingDomain/User/src/UseCase/Create/CreateUseCaseResult.php b/src/HandlingDomain/User/src/UseCase/Create/CreateUseCaseResult.php new file mode 100644 index 0000000..b2e1b1a --- /dev/null +++ b/src/HandlingDomain/User/src/UseCase/Create/CreateUseCaseResult.php @@ -0,0 +1,20 @@ +user; + } +} \ No newline at end of file diff --git a/src/HandlingDomain/User/src/UseCase/ReadList/ReadListUseCase.php b/src/HandlingDomain/User/src/UseCase/ReadList/ReadListUseCase.php new file mode 100644 index 0000000..125469b --- /dev/null +++ b/src/HandlingDomain/User/src/UseCase/ReadList/ReadListUseCase.php @@ -0,0 +1,30 @@ +page; + } + + public function getPerPage(): int + { + return $this->perPage; + } + + public function getQuery(): ?string + { + return $this->query; + } +} \ No newline at end of file diff --git a/src/HandlingDomain/User/src/UseCase/ReadList/ReadListUseCaseBuilder.php b/src/HandlingDomain/User/src/UseCase/ReadList/ReadListUseCaseBuilder.php new file mode 100644 index 0000000..2732da0 --- /dev/null +++ b/src/HandlingDomain/User/src/UseCase/ReadList/ReadListUseCaseBuilder.php @@ -0,0 +1,20 @@ + [ - - /// Rule - UserPasswordMatchesRule::class => AutoWiringFactory::class, - - /// Builder - UserSessionBuilder::class => AutoWiringFactory::class, - - /// CQRS - // Login User - LoginUserCommandHandler::class => InjectionFactory::class, - LoginUserCommandBuilder::class => AutoWiringFactory::class, - - // Logout User - LogoutUserCommandHandler::class => InjectionFactory::class, - LogoutUserCommandBuilder::class => AutoWiringFactory::class, - ], -]; diff --git a/src/HandlingDomain/UserSession/src/ConfigProvider.php b/src/HandlingDomain/UserSession/src/ConfigProvider.php deleted file mode 100644 index ad22134..0000000 --- a/src/HandlingDomain/UserSession/src/ConfigProvider.php +++ /dev/null @@ -1,15 +0,0 @@ - require __DIR__ . '/./../config/service_manager.php', - ]; - } -} diff --git a/src/HandlingDomain/UserSession/src/Handler/Command/LoginUser/LoginUserCommand.php b/src/HandlingDomain/UserSession/src/Handler/Command/LoginUser/LoginUserCommand.php deleted file mode 100644 index a289c83..0000000 --- a/src/HandlingDomain/UserSession/src/Handler/Command/LoginUser/LoginUserCommand.php +++ /dev/null @@ -1,29 +0,0 @@ -session; - } - - public function getIdentifier(): string { - return $this->identifier; - } - - public function getPassword(): string { - return $this->password; - } -} - -?> \ No newline at end of file diff --git a/src/HandlingDomain/UserSession/src/Handler/Command/LoginUser/LoginUserCommandBuilder.php b/src/HandlingDomain/UserSession/src/Handler/Command/LoginUser/LoginUserCommandBuilder.php deleted file mode 100644 index 826e121..0000000 --- a/src/HandlingDomain/UserSession/src/Handler/Command/LoginUser/LoginUserCommandBuilder.php +++ /dev/null @@ -1,23 +0,0 @@ - \ No newline at end of file diff --git a/src/HandlingDomain/UserSession/src/Handler/Command/LogoutUser/LogoutUserCommand.php b/src/HandlingDomain/UserSession/src/Handler/Command/LogoutUser/LogoutUserCommand.php deleted file mode 100644 index 6d4f9e2..0000000 --- a/src/HandlingDomain/UserSession/src/Handler/Command/LogoutUser/LogoutUserCommand.php +++ /dev/null @@ -1,19 +0,0 @@ -session; - } -} - -?> \ No newline at end of file diff --git a/src/HandlingDomain/UserSession/src/Handler/Command/LogoutUser/LogoutUserCommandBuilder.php b/src/HandlingDomain/UserSession/src/Handler/Command/LogoutUser/LogoutUserCommandBuilder.php deleted file mode 100644 index 32b6bba..0000000 --- a/src/HandlingDomain/UserSession/src/Handler/Command/LogoutUser/LogoutUserCommandBuilder.php +++ /dev/null @@ -1,19 +0,0 @@ - \ No newline at end of file diff --git a/src/HandlingDomain/UserSession/src/Handler/Command/LogoutUser/LogoutUserCommandHandler.php b/src/HandlingDomain/UserSession/src/Handler/Command/LogoutUser/LogoutUserCommandHandler.php deleted file mode 100644 index 319e0af..0000000 --- a/src/HandlingDomain/UserSession/src/Handler/Command/LogoutUser/LogoutUserCommandHandler.php +++ /dev/null @@ -1,37 +0,0 @@ -getSession(); - $this->entityManager->remove($session); - $this->entityManager->flush(); - - return $session; - } -} - -?> \ No newline at end of file diff --git a/src/HandlingDomain/Role/src/Exception/RoleNotFoundByIdentifierException.php b/src/Infrastructure/Rbac/src/Exception/RoleNotFoundByIdentifierException.php similarity index 71% rename from src/HandlingDomain/Role/src/Exception/RoleNotFoundByIdentifierException.php rename to src/Infrastructure/Rbac/src/Exception/RoleNotFoundByIdentifierException.php index c4675c5..2ad98ae 100644 --- a/src/HandlingDomain/Role/src/Exception/RoleNotFoundByIdentifierException.php +++ b/src/Infrastructure/Rbac/src/Exception/RoleNotFoundByIdentifierException.php @@ -1,12 +1,12 @@