From 0de7e61e93d9fcf47f3a17859bf81c1f46996161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Odwa=C5=BCny?= Date: Wed, 4 Dec 2024 18:01:26 +0100 Subject: [PATCH 1/3] upgrade to 1.14 --- .github/workflows/build.yml | 10 +- .github/workflows/coding_standard.yml | 8 +- composer.json | 4 +- .../config/sylius/1.14/bundles.php | 14 ++ .../config/sylius/1.14/packages/_sylius.yaml | 10 ++ .../config/sylius/1.14/packages/security.yaml | 124 ++++++++++++++++++ 6 files changed, 161 insertions(+), 9 deletions(-) create mode 100644 tests/Application/config/sylius/1.14/bundles.php create mode 100644 tests/Application/config/sylius/1.14/packages/_sylius.yaml create mode 100644 tests/Application/config/sylius/1.14/packages/security.yaml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6a63d45..8ca566f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,15 +23,17 @@ jobs: matrix: php: ["8.0", "8.1", "8.2", "8.3"] symfony: ["^5.4", "^6.4"] - sylius: ["~1.12.0", "~1.13.0"] + sylius: ["~1.12.0", "~1.13.0", "~1.14.0"] node: ["^18.0", "^20.0"] mysql: ["8.0"] exclude: - sylius: "~1.13.0" - php: "8.0" + php: 8.0 + - sylius: "~1.14.0" + php: 8.0 - sylius: "~1.12.0" - php: "8.0" - symfony: "^6.4" + php: 8.0 + symfony: ^6.4 env: APP_ENV: test diff --git a/.github/workflows/coding_standard.yml b/.github/workflows/coding_standard.yml index ef183fe..e0a943c 100644 --- a/.github/workflows/coding_standard.yml +++ b/.github/workflows/coding_standard.yml @@ -20,13 +20,15 @@ jobs: matrix: php: [ "8.0", "8.1", "8.2", "8.3" ] symfony: [ "^5.4", "^6.4" ] - sylius: [ "^1.12", "^1.13" ] + sylius: ["~1.12.0", "~1.13.0", "~1.14.0"] node: [ "18.x", "20.x" ] exclude: - - sylius: ^1.13 + - sylius: "~1.13.0" php: 8.0 - - sylius: ^1.12 + - sylius: "~1.14.0" + php: 8.0 + - sylius: "~1.12.0" php: 8.0 symfony: ^6.4 diff --git a/composer.json b/composer.json index 1076bc9..ccb8687 100644 --- a/composer.json +++ b/composer.json @@ -5,8 +5,8 @@ "description": "Blacklist plugin for Sylius.", "license": "MIT", "require": { - "php": "^8.0 || ^8.1 || ^8.2 || ^8.3", - "sylius/sylius": "~1.12.0 || ~1.13.0", + "php": "^8.0", + "sylius/sylius": "^1.12", "doctrine/annotations": "^2.0.0" }, "require-dev": { diff --git a/tests/Application/config/sylius/1.14/bundles.php b/tests/Application/config/sylius/1.14/bundles.php new file mode 100644 index 0000000..e615f85 --- /dev/null +++ b/tests/Application/config/sylius/1.14/bundles.php @@ -0,0 +1,14 @@ + ['all' => true], +]; diff --git a/tests/Application/config/sylius/1.14/packages/_sylius.yaml b/tests/Application/config/sylius/1.14/packages/_sylius.yaml new file mode 100644 index 0000000..baa3d7e --- /dev/null +++ b/tests/Application/config/sylius/1.14/packages/_sylius.yaml @@ -0,0 +1,10 @@ +parameters: + test_default_state_machine_adapter: 'symfony_workflow' + test_sylius_state_machine_adapter: '%env(string:default:test_default_state_machine_adapter:TEST_SYLIUS_STATE_MACHINE_ADAPTER)%' + +sylius_state_machine_abstraction: + graphs_to_adapters_mapping: + sylius_refund_refund_payment: '%test_sylius_state_machine_adapter%' + +sylius_api: + enabled: true diff --git a/tests/Application/config/sylius/1.14/packages/security.yaml b/tests/Application/config/sylius/1.14/packages/security.yaml new file mode 100644 index 0000000..4ed342f --- /dev/null +++ b/tests/Application/config/sylius/1.14/packages/security.yaml @@ -0,0 +1,124 @@ +security: + enable_authenticator_manager: true + providers: + sylius_admin_user_provider: + id: sylius.admin_user_provider.email_or_name_based + sylius_api_admin_user_provider: + id: sylius.admin_user_provider.email_or_name_based + sylius_shop_user_provider: + id: sylius.shop_user_provider.email_or_name_based + sylius_api_shop_user_provider: + id: sylius.shop_user_provider.email_or_name_based + + password_hashers: + Sylius\Component\User\Model\UserInterface: argon2i + firewalls: + admin: + switch_user: true + context: admin + pattern: "%sylius.security.admin_regex%" + provider: sylius_admin_user_provider + form_login: + provider: sylius_admin_user_provider + login_path: sylius_admin_login + check_path: sylius_admin_login_check + failure_path: sylius_admin_login + default_target_path: sylius_admin_dashboard + use_forward: false + use_referer: true + enable_csrf: true + csrf_parameter: _csrf_admin_security_token + csrf_token_id: admin_authenticate + remember_me: + secret: "%env(APP_SECRET)%" + path: "/%sylius_admin.path_name%" + name: APP_ADMIN_REMEMBER_ME + lifetime: 31536000 + remember_me_parameter: _remember_me + logout: + path: sylius_admin_logout + target: sylius_admin_login + + new_api_admin_user: + pattern: "%sylius.security.new_api_admin_regex%/.*" + provider: sylius_api_admin_user_provider + stateless: true + entry_point: jwt + json_login: + check_path: "%sylius.security.new_api_admin_route%/authentication-token" + username_path: email + password_path: password + success_handler: lexik_jwt_authentication.handler.authentication_success + failure_handler: lexik_jwt_authentication.handler.authentication_failure + jwt: true + + new_api_shop_user: + pattern: "%sylius.security.new_api_shop_regex%/.*" + provider: sylius_api_shop_user_provider + stateless: true + entry_point: jwt + json_login: + check_path: "%sylius.security.new_api_shop_route%/authentication-token" + username_path: email + password_path: password + success_handler: lexik_jwt_authentication.handler.authentication_success + failure_handler: lexik_jwt_authentication.handler.authentication_failure + jwt: true + + shop: + switch_user: { role: ROLE_ALLOWED_TO_SWITCH } + context: shop + pattern: "%sylius.security.shop_regex%" + provider: sylius_shop_user_provider + form_login: + success_handler: sylius.authentication.success_handler + failure_handler: sylius.authentication.failure_handler + provider: sylius_shop_user_provider + login_path: sylius_shop_login + check_path: sylius_shop_login_check + failure_path: sylius_shop_login + default_target_path: sylius_shop_homepage + use_forward: false + use_referer: true + enable_csrf: true + csrf_parameter: _csrf_shop_security_token + csrf_token_id: shop_authenticate + remember_me: + secret: "%env(APP_SECRET)%" + name: APP_SHOP_REMEMBER_ME + lifetime: 31536000 + remember_me_parameter: _remember_me + logout: + path: sylius_shop_logout + target: sylius_shop_homepage + invalidate_session: false + + dev: + pattern: ^/(_(profiler|wdt)|css|images|js)/ + security: false + + image_resolver: + pattern: ^/media/cache/resolve + security: false + + access_control: + - { path: "%sylius.security.admin_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } + - { path: "%sylius.security.admin_regex%/_partial", role: ROLE_NO_ACCESS } + - { path: "%sylius.security.shop_regex%/_partial", role: PUBLIC_ACCESS, ips: [127.0.0.1, ::1] } + - { path: "%sylius.security.shop_regex%/_partial", role: ROLE_NO_ACCESS } + + - { path: "%sylius.security.admin_regex%/login", role: PUBLIC_ACCESS } + - { path: "%sylius.security.shop_regex%/login", role: PUBLIC_ACCESS } + + - { path: "%sylius.security.shop_regex%/register", role: PUBLIC_ACCESS } + - { path: "%sylius.security.shop_regex%/verify", role: PUBLIC_ACCESS } + + - { path: "%sylius.security.admin_regex%", role: ROLE_ADMINISTRATION_ACCESS } + - { path: "%sylius.security.shop_regex%/account", role: ROLE_USER } + + - { path: "%sylius.security.new_api_admin_route%/reset-password-requests", role: PUBLIC_ACCESS } + - { path: "%sylius.security.new_api_admin_regex%/.*", role: ROLE_API_ACCESS } + - { path: "%sylius.security.new_api_admin_route%/authentication-token", role: PUBLIC_ACCESS } + - { path: "%sylius.security.new_api_user_account_regex%/.*", role: ROLE_USER } + - { path: "%sylius.security.new_api_shop_route%/authentication-token", role: PUBLIC_ACCESS } + - { path: "%sylius.security.new_api_shop_regex%/.*", role: PUBLIC_ACCESS } From df0738f2586f5f353483352ec8d938d1f69ced2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Odwa=C5=BCny?= Date: Wed, 8 Jan 2025 06:28:52 +0100 Subject: [PATCH 2/3] removing doctrine/annotations from require list From ba8eef2fc248084fbc543d2e05defc5daf11f863 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Odwa=C5=BCny?= Date: Wed, 8 Jan 2025 15:44:17 +0100 Subject: [PATCH 3/3] Update composer.json removing doctrine/annotations from require list --- composer.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/composer.json b/composer.json index ccb8687..f63eb7e 100644 --- a/composer.json +++ b/composer.json @@ -6,8 +6,7 @@ "license": "MIT", "require": { "php": "^8.0", - "sylius/sylius": "^1.12", - "doctrine/annotations": "^2.0.0" + "sylius/sylius": "^1.12" }, "require-dev": { "behat/behat": "^3.7.0",