From b2950a8209904f10f1174843eaa3d05fdea8005d Mon Sep 17 00:00:00 2001 From: Etienne Gutbub Date: Tue, 23 Jan 2024 15:19:24 +0100 Subject: [PATCH 1/5] feat(Permissions): Allow permission RBAC for sylius plus on routes --- src/Resources/config/routes/admin.yaml | 16 ++++++++++++++++ src/Resources/translations/messages.en.yaml | 10 ++++++++++ src/Resources/translations/messages.fr.yaml | 10 ++++++++++ 3 files changed, 36 insertions(+) diff --git a/src/Resources/config/routes/admin.yaml b/src/Resources/config/routes/admin.yaml index d6f4547b2..b4146837b 100644 --- a/src/Resources/config/routes/admin.yaml +++ b/src/Resources/config/routes/admin.yaml @@ -2,13 +2,29 @@ monsieurbiz_sylius_settings_admin_index: path: settings controller: MonsieurBiz\SyliusSettingsPlugin\Controller\SettingsController::indexAction methods: ['GET'] + defaults: + _sylius: + alias: monsieurbiz.settings_admin_index + section: admin + permission: true + monsieurbiz_sylius_settings_admin_edit: path: settings/edit/{alias} controller: MonsieurBiz\SyliusSettingsPlugin\Controller\SettingsController::formAction methods: ['GET'] + defaults: + _sylius: + alias: monsieurbiz.settings_admin_edit + section: admin + permission: true monsieurbiz_sylius_settings_admin_edit_post: path: settings/edit/{alias} controller: MonsieurBiz\SyliusSettingsPlugin\Controller\SettingsController::formAction methods: ['PUT'] + defaults: + _sylius: + alias: monsieurbiz.settings_admin_edit_post + section: admin + permission: true diff --git a/src/Resources/translations/messages.en.yaml b/src/Resources/translations/messages.en.yaml index 44ceacc7d..6587bb10d 100644 --- a/src/Resources/translations/messages.en.yaml +++ b/src/Resources/translations/messages.en.yaml @@ -18,3 +18,13 @@ monsieurbiz: title: sylius_default_values: Sylius' default values channel_default_values: Default values for %channelName% +sylius_plus: + rbac: + parent: + monsieurbiz: + settings_admin_edit_posts: 'Save settings' + settings_admin_edits: 'Edit settings' + settings_admin_indices: 'Settings list' + monsieurbiz_sylius_settings_admin_edit_post: 'Save' + monsieurbiz_sylius_settings_admin_edit: 'Update' + monsieurbiz_sylius_settings_admin_index: 'Index' diff --git a/src/Resources/translations/messages.fr.yaml b/src/Resources/translations/messages.fr.yaml index 390e5ff35..492e2e8e1 100644 --- a/src/Resources/translations/messages.fr.yaml +++ b/src/Resources/translations/messages.fr.yaml @@ -18,3 +18,13 @@ monsieurbiz: title: sylius_default_values: Valeurs par défaut de Sylius channel_default_values: Valeurs par défaut de %channelName% +sylius_plus: + rbac: + parent: + monsieurbiz: + settings_admin_edit_posts: 'Sauvegarde réglages' + settings_admin_edits: 'Éditer réglages' + settings_admin_indices: 'Lister réglages' + monsieurbiz_sylius_settings_admin_edit_post: 'Sauvegarde' + monsieurbiz_sylius_settings_admin_edit: 'Update' + monsieurbiz_sylius_settings_admin_index: 'Index' From 08f8ade7e4f88d42c204dfb9b77e366361be2606 Mon Sep 17 00:00:00 2001 From: Etienne Gutbub Date: Tue, 23 Jan 2024 15:40:30 +0100 Subject: [PATCH 2/5] feat(cache): allow version 7.0 of symfony cache --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index fbf6073f7..7ec497785 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ "ext-mbstring": "*", "ext-json": "*", "sylius/sylius": ">=1.10 <1.13", - "symfony/cache": "^5.4.28 || ^6.0" + "symfony/cache": "^5.4.28 || ^6.0 || ^7.0" }, "require-dev": { "behat/behat": "^3.6.1", From da80a9e1a9ee23bbf092e05d3f0e8f9e0fd56a4b Mon Sep 17 00:00:00 2001 From: Etienne Gutbub Date: Wed, 24 Jan 2024 10:14:10 +0100 Subject: [PATCH 3/5] ci(codespace): remove duplicates in makefile --- Makefile | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/Makefile b/Makefile index 52c6e2a04..eb16aa52a 100644 --- a/Makefile +++ b/Makefile @@ -211,19 +211,6 @@ codespace.hostname: ${APP_DIR}/.env.local ## Init the SYLIUS_FIXTURES_HOSTNAME v echo SYLIUS_FIXTURES_HOSTNAME=${CODESPACE_NAME}-8000.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN} >> ${APP_DIR}/.env.local endif -${APP_DIR}/.env.local: - touch ${APP_DIR}/.env.local - - -### -### GITHUB CODESPACES -### ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ - -codespace.hostname: ${APP_DIR}/.env.local ## Init the SYLIUS_FIXTURES_HOSTNAME variable in .env.local -ifdef CODESPACES - echo SYLIUS_FIXTURES_HOSTNAME=${CODESPACE_NAME}-8000.${GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN} >> ${APP_DIR}/.env.local -endif - ${APP_DIR}/.env.local: touch ${APP_DIR}/.env.local From a4cd22502452ef11e1ab244ec402e9c5b4397466 Mon Sep 17 00:00:00 2001 From: Etienne Gutbub Date: Wed, 24 Jan 2024 10:51:32 +0100 Subject: [PATCH 4/5] ci(composer cache): Update CI --- .github/workflows/recipe.yaml | 30 ++++++++++------- .github/workflows/security.yaml | 34 +++++++++---------- .github/workflows/tests.yaml | 58 ++++++++++++++++----------------- 3 files changed, 63 insertions(+), 59 deletions(-) diff --git a/.github/workflows/recipe.yaml b/.github/workflows/recipe.yaml index 6b8aa5f07..9a0b4a3b8 100644 --- a/.github/workflows/recipe.yaml +++ b/.github/workflows/recipe.yaml @@ -46,18 +46,24 @@ jobs: - run: mkdir -p /home/runner/{.composer/cache,.config/composer} - - uses: actions/cache@v3 - id: cache-composer - with: - path: /home/runner/.composer/cache - key: composer2-php:${{ matrix.php }}-sylius:${{ matrix.sylius }}-${{ github.sha }} - restore-keys: composer2-php:${{ matrix.php }}-sylius:${{ matrix.sylius }}- - - - name: Composer - run: sudo composer self-update - - - name: Composer Github Auth - run: composer config -g github-oauth.github.com ${{ github.token }} + - name: Determine composer cache directory + id: composer-cache-directory + working-directory: plugin + run: echo "directory=$(composer config cache-dir)" >> $GITHUB_OUTPUT + + - name: Cache dependencies installed with composer + uses: actions/cache@v3 + id: cache-composer + with: + path: ${{ steps.composer-cache-directory.outputs.directory }} + key: composer2-php:${{ matrix.php }}-sylius:${{ matrix.sylius }}-${{ hashFiles('**/composer.json') }} + restore-keys: composer2-php:${{ matrix.php }}-sylius:${{ matrix.sylius }}- + + - name: Ensure that composer cache directory exists + run: mkdir -p ${{ steps.composer-cache-directory.outputs.directory }} + + - name: Composer Github Auth + run: composer config -g github-oauth.github.com ${{ github.token }} - name: Create Sylius-Standard project without install run: | diff --git a/.github/workflows/security.yaml b/.github/workflows/security.yaml index 630420dec..0522893de 100644 --- a/.github/workflows/security.yaml +++ b/.github/workflows/security.yaml @@ -30,23 +30,23 @@ jobs: run: | echo ${{ matrix.php }} > .php-version - - uses: actions/cache@v3 - id: cache-composer - with: - path: /home/runner/.composer/cache - key: composer2-php:${{ matrix.php }}-${{ github.sha }} - restore-keys: composer2-php:${{ matrix.php }}- - - - run: mkdir -p /home/runner/{.composer/cache,.config/composer} - if: steps.cache-composer.outputs.cache-hit != 'true' - - - name: Composer - run: sudo composer self-update - - - name: Composer Github Auth - run: composer config -g github-oauth.github.com ${{ github.token }} - - - uses: actions/checkout@v2 + - name: Determine composer cache directory + id: composer-cache-directory + run: echo "directory=$(composer config cache-dir)" >> $GITHUB_OUTPUT + + - name: Cache dependencies installed with composer + uses: actions/cache@v3 + id: cache-composer + with: + path: ${{ steps.composer-cache-directory.outputs.directory }} + key: composer2-php:${{ matrix.php }}-${{ hashFiles('**/composer.json') }} + restore-keys: composer2-php:${{ matrix.php }}- + + - name: Ensure that composer cache directory exists + run: mkdir -p ${{ steps.composer-cache-directory.outputs.directory }} + + - name: Composer Github Auth + run: composer config -g github-oauth.github.com ${{ github.token }} - name: Install PHP dependencies run: composer update --prefer-dist diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 25bed714e..42c050297 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -30,36 +30,34 @@ jobs: with: node-version: '14' - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: ${{ matrix.php }} - ini-values: date.timezone=UTC - - - name: Set project php-version - run: | - echo ${{ matrix.php }} > .php-version - - - name: Install symfony CLI - run: | - curl https://get.symfony.com/cli/installer | bash - echo "${HOME}/.symfony5/bin" >> $GITHUB_PATH - - - uses: actions/cache@v3 - id: cache-composer - with: - path: /home/runner/.composer/cache - key: composer2-php:${{ matrix.php }}-${{ github.sha }} - restore-keys: composer2-php:${{ matrix.php }}- - - - run: mkdir -p /home/runner/{.composer/cache,.config/composer} - if: steps.cache-composer.outputs.cache-hit != 'true' - - - name: Composer - run: sudo composer self-update - - - name: Composer Github Auth - run: composer config -g github-oauth.github.com ${{ github.token }} + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + ini-values: date.timezone=UTC + tools: symfony-cli + + - name: Set project php-version + run: | + echo ${{ matrix.php }} > .php-version + + - name: Determine composer cache directory + id: composer-cache-directory + run: echo "directory=$(composer config cache-dir)" >> $GITHUB_OUTPUT + + - name: Cache dependencies installed with composer + uses: actions/cache@v3 + id: cache-composer + with: + path: ${{ steps.composer-cache-directory.outputs.directory }} + key: composer2-php:${{ matrix.php }}-${{ hashFiles('**/composer.json') }} + restore-keys: composer2-php:${{ matrix.php }}- + + - name: Ensure that composer cache directory exists + run: mkdir -p ${{ steps.composer-cache-directory.outputs.directory }} + + - name: Composer Github Auth + run: composer config -g github-oauth.github.com ${{ github.token }} - run: make install From 30166e05217c1e70c3f5a0543ba6b5a8f413d6d2 Mon Sep 17 00:00:00 2001 From: Etienne Gutbub Date: Wed, 24 Jan 2024 11:39:46 +0100 Subject: [PATCH 5/5] ci(twig bridge): add require dev for twig-bridge version --- composer.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 7ec497785..37a58a371 100644 --- a/composer.json +++ b/composer.json @@ -43,7 +43,8 @@ "symfony/flex": "@stable", "symfony/web-profiler-bundle": "@stable", "phpmd/phpmd": "@stable", - "friendsofphp/php-cs-fixer": "@stable" + "friendsofphp/php-cs-fixer": "@stable", + "symfony/twig-bridge": "^5.4" }, "prefer-stable": true, "autoload": {