From a2fbb711331027e8c183a0621eb041208a03a928 Mon Sep 17 00:00:00 2001 From: Dimitri Gritsajuk Date: Thu, 5 Dec 2024 14:00:47 +0100 Subject: [PATCH] Fix tests --- .php-cs-fixer.dist.php | 1 - composer.json | 5 +- composer.lock | 306 +++++------------- .../Admin/AdminCommitteeController.php | 1 - .../AuthenticatedAppLinkController.php | 2 - .../Filter/GetCollectionFiltersController.php | 3 +- .../Api/Security/GetJWTTokenController.php | 3 +- src/Controller/Api/UserController.php | 1 - .../EnMarche/CommitteeController.php | 3 - src/Controller/EnMarche/LegacyController.php | 33 -- .../SaveCommitteeUpdateController.php | 1 - .../ShowCommitteeListController.php | 1 - src/Entity/EntityIdentityTrait.php | 9 +- src/Entity/Event/BaseEvent.php | 2 +- src/Entity/Event/BaseEventCategory.php | 4 +- src/Entity/Event/EventCategory.php | 2 +- src/Entity/Geo/GeoTrait.php | 2 +- .../EntityCategoryFromSlugDenormalizer.php | 36 +++ symfony.lock | 21 -- .../Admin/SecurityControllerCaseTest.php | 1 - 20 files changed, 138 insertions(+), 299 deletions(-) delete mode 100644 src/Controller/EnMarche/LegacyController.php create mode 100644 src/Normalizer/EntityCategoryFromSlugDenormalizer.php diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index 69201b099d5..234fef9092e 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -16,7 +16,6 @@ '@PHP82Migration' => true, '@PHP80Migration:risky' => true, '@Symfony' => true, - '@DoctrineAnnotation' => true, 'phpdoc_summary' => false, 'no_unneeded_final_method' => false, 'declare_strict_types' => false, diff --git a/composer.json b/composer.json index 734c69d3a85..2926bbeb93c 100644 --- a/composer.json +++ b/composer.json @@ -72,7 +72,7 @@ "league/iso3166": "^4.3", "league/oauth2-server": "^8.2", "lexik/paybox-bundle": "dev-master", - "longitude-one/doctrine-spatial": "*", + "longitude-one/doctrine-spatial": "^4.0", "myclabs/php-enum": "^1.5", "nelmio/cors-bundle": "^2.2", "nyholm/psr7": "^1.5", @@ -81,11 +81,10 @@ "phpoffice/phpspreadsheet": "^3.3", "ramsey/uuid": "^4.1", "ramsey/uuid-doctrine": "^2.0", - "runroom-packages/sortable-behavior-bundle": "^0.17.1", + "runroom-packages/sortable-behavior-bundle": "^0.18.0", "sabre/dav": "^4.1", "scheb/2fa-bundle": "^6.3", "scheb/2fa-google-authenticator": "^6.3", - "sensio/framework-extra-bundle": "^6.0", "sentry/sentry-symfony": "^5.0", "sonata-project/admin-bundle": "^4.32", "sonata-project/doctrine-orm-admin-bundle": "^4.15", diff --git a/composer.lock b/composer.lock index bf51c76efb8..0805042a137 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "a49f9b2fc011d3123f4936d6d9a0456f", + "content-hash": "7231f03648114592d09649cec7da711f", "packages": [ { "name": "a2lix/auto-form-bundle", @@ -532,27 +532,30 @@ }, { "name": "beberlei/doctrineextensions", - "version": "v1.3.0", + "version": "v1.4.0", "source": { "type": "git", "url": "https://github.com/beberlei/DoctrineExtensions.git", - "reference": "008f162f191584a6c37c03a803f718802ba9dd9a" + "reference": "249eab82aa35b65741388f38499b3162403d9956" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/beberlei/DoctrineExtensions/zipball/008f162f191584a6c37c03a803f718802ba9dd9a", - "reference": "008f162f191584a6c37c03a803f718802ba9dd9a", + "url": "https://api.github.com/repos/beberlei/DoctrineExtensions/zipball/249eab82aa35b65741388f38499b3162403d9956", + "reference": "249eab82aa35b65741388f38499b3162403d9956", "shasum": "" }, "require": { - "doctrine/orm": "^2.7", + "doctrine/orm": "^2.15", "php": "^7.2 || ^8.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.14", + "doctrine/annotations": "^1.14 || ^2", + "doctrine/coding-standard": "^9.0.2 || ^12.0", "nesbot/carbon": "*", "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", - "symfony/yaml": "^4.2 || ^5.0", + "squizlabs/php_codesniffer": "^3.8", + "symfony/cache": "^4.4 || ^5.4 || ^6.4 || ^7.0", + "symfony/yaml": "^4.4 || ^5.3 || ^6.0 || ^7.0", "zf1/zend-date": "^1.12", "zf1/zend-registry": "^1.12" }, @@ -583,9 +586,9 @@ "orm" ], "support": { - "source": "https://github.com/beberlei/DoctrineExtensions/tree/v1.3.0" + "source": "https://github.com/beberlei/DoctrineExtensions/tree/v1.4.0" }, - "time": "2020-11-29T07:37:23+00:00" + "time": "2024-02-05T17:02:44+00:00" }, { "name": "behat/transliterator", @@ -1557,82 +1560,6 @@ }, "time": "2024-07-08T12:26:09+00:00" }, - { - "name": "doctrine/annotations", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/doctrine/annotations.git", - "reference": "901c2ee5d26eb64ff43c47976e114bf00843acf7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/901c2ee5d26eb64ff43c47976e114bf00843acf7", - "reference": "901c2ee5d26eb64ff43c47976e114bf00843acf7", - "shasum": "" - }, - "require": { - "doctrine/lexer": "^2 || ^3", - "ext-tokenizer": "*", - "php": "^7.2 || ^8.0", - "psr/cache": "^1 || ^2 || ^3" - }, - "require-dev": { - "doctrine/cache": "^2.0", - "doctrine/coding-standard": "^10", - "phpstan/phpstan": "^1.10.28", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", - "symfony/cache": "^5.4 || ^6.4 || ^7", - "vimeo/psalm": "^4.30 || ^5.14" - }, - "suggest": { - "php": "PHP 8.0 or higher comes with attributes, a native replacement for annotations" - }, - "type": "library", - "autoload": { - "psr-4": { - "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Docblock Annotations Parser", - "homepage": "https://www.doctrine-project.org/projects/annotations.html", - "keywords": [ - "annotations", - "docblock", - "parser" - ], - "support": { - "issues": "https://github.com/doctrine/annotations/issues", - "source": "https://github.com/doctrine/annotations/tree/2.0.2" - }, - "time": "2024-09-05T10:17:24+00:00" - }, { "name": "doctrine/cache", "version": "2.2.0", @@ -5399,16 +5326,16 @@ }, { "name": "knplabs/knp-menu", - "version": "v3.5.0", + "version": "v3.6.0", "source": { "type": "git", "url": "https://github.com/KnpLabs/KnpMenu.git", - "reference": "c39403f7c427d1b72cc56f38df0a075b4b9191fe" + "reference": "ac96b711cf7b4178747b0ecde79d7e5e05dbcd28" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/KnpLabs/KnpMenu/zipball/c39403f7c427d1b72cc56f38df0a075b4b9191fe", - "reference": "c39403f7c427d1b72cc56f38df0a075b4b9191fe", + "url": "https://api.github.com/repos/KnpLabs/KnpMenu/zipball/ac96b711cf7b4178747b0ecde79d7e5e05dbcd28", + "reference": "ac96b711cf7b4178747b0ecde79d7e5e05dbcd28", "shasum": "" }, "require": { @@ -5466,26 +5393,26 @@ ], "support": { "issues": "https://github.com/KnpLabs/KnpMenu/issues", - "source": "https://github.com/KnpLabs/KnpMenu/tree/v3.5.0" + "source": "https://github.com/KnpLabs/KnpMenu/tree/v3.6.0" }, - "time": "2024-03-23T15:35:09+00:00" + "time": "2024-12-20T10:10:51+00:00" }, { "name": "knplabs/knp-menu-bundle", - "version": "v3.4.2", + "version": "v3.5.0", "source": { "type": "git", "url": "https://github.com/KnpLabs/KnpMenuBundle.git", - "reference": "6a1e3e1f4131f9a5a967e36717a1fe680c183637" + "reference": "5f85a4908343c3d6a6009c2f8a74c2d102c0aa80" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/KnpLabs/KnpMenuBundle/zipball/6a1e3e1f4131f9a5a967e36717a1fe680c183637", - "reference": "6a1e3e1f4131f9a5a967e36717a1fe680c183637", + "url": "https://api.github.com/repos/KnpLabs/KnpMenuBundle/zipball/5f85a4908343c3d6a6009c2f8a74c2d102c0aa80", + "reference": "5f85a4908343c3d6a6009c2f8a74c2d102c0aa80", "shasum": "" }, "require": { - "knplabs/knp-menu": "^3.3", + "knplabs/knp-menu": "^3.6", "php": "^8.1", "symfony/deprecation-contracts": "^2.5 | ^3.3", "symfony/framework-bundle": "^5.4 | ^6.0 | ^7.0" @@ -5531,9 +5458,9 @@ ], "support": { "issues": "https://github.com/KnpLabs/KnpMenuBundle/issues", - "source": "https://github.com/KnpLabs/KnpMenuBundle/tree/v3.4.2" + "source": "https://github.com/KnpLabs/KnpMenuBundle/tree/v3.5.0" }, - "time": "2024-06-03T08:48:36+00:00" + "time": "2024-12-25T16:34:19+00:00" }, { "name": "knplabs/knp-time-bundle", @@ -9923,28 +9850,28 @@ }, { "name": "runroom-packages/sortable-behavior-bundle", - "version": "0.17.1", + "version": "0.18.0", "source": { "type": "git", "url": "https://github.com/Runroom/RunroomSortableBehaviorBundle.git", - "reference": "ef29964f1a43c3ffbc297fa4228112c1573fbf6b" + "reference": "6004e079a29018d5de469e2a56da45a77235cabe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Runroom/RunroomSortableBehaviorBundle/zipball/ef29964f1a43c3ffbc297fa4228112c1573fbf6b", - "reference": "ef29964f1a43c3ffbc297fa4228112c1573fbf6b", + "url": "https://api.github.com/repos/Runroom/RunroomSortableBehaviorBundle/zipball/6004e079a29018d5de469e2a56da45a77235cabe", + "reference": "6004e079a29018d5de469e2a56da45a77235cabe", "shasum": "" }, "require": { "doctrine/doctrine-bundle": "^2.8", "doctrine/orm": "^2.14", "php": "^8.1", - "symfony/config": "^5.4 || ^6.2", - "symfony/dependency-injection": "^5.4 || ^6.2", - "symfony/http-foundation": "^5.4 || ^6.2", - "symfony/http-kernel": "^5.4 || ^6.2", - "symfony/property-access": "^5.4 || ^6.2", - "symfony/translation": "^5.4 || ^6.2", + "symfony/config": "^5.4 || ^6.4", + "symfony/dependency-injection": "^5.4 || ^6.4", + "symfony/http-foundation": "^5.4 || ^6.4", + "symfony/http-kernel": "^5.4 || ^6.4", + "symfony/property-access": "^5.4 || ^6.4", + "symfony/translation": "^5.4 || ^6.4", "twig/twig": "^3.0" }, "conflict": { @@ -9952,22 +9879,22 @@ "sonata-project/admin-bundle": "<4.0" }, "require-dev": { - "dama/doctrine-test-bundle": "^7.2", + "dama/doctrine-test-bundle": "^8.0", "gedmo/doctrine-extensions": "^3.11", "knplabs/knp-menu-bundle": "^3.1", - "matthiasnoback/symfony-config-test": "^4.2", - "matthiasnoback/symfony-dependency-injection-test": "^4.2", + "matthiasnoback/symfony-config-test": "^5.1", + "matthiasnoback/symfony-dependency-injection-test": "^5.1", "phpunit/phpunit": "^9.6", "psr/container": "^1.1 || ^2.0", - "runroom-packages/testing": "^0.17.1", + "runroom-packages/testing": "^0.18", "sonata-project/admin-bundle": "^4.20", "sonata-project/doctrine-orm-admin-bundle": "^4.3", - "symfony/browser-kit": "^5.4 || ^6.2", - "symfony/framework-bundle": "^5.4 || ^6.2", - "symfony/phpunit-bridge": "^6.3", - "symfony/security-bundle": "^5.4 || ^6.2", - "symfony/twig-bundle": "^5.4 || ^6.2", - "zenstruck/foundry": "^1.34" + "symfony/browser-kit": "^5.4 || ^6.4", + "symfony/framework-bundle": "^5.4 || ^6.4", + "symfony/phpunit-bridge": "^7.0", + "symfony/security-bundle": "^5.4 || ^6.4", + "symfony/twig-bundle": "^5.4 || ^6.4", + "zenstruck/foundry": "^1.38.2 || ^2.0" }, "type": "symfony-bundle", "extra": { @@ -9999,9 +9926,9 @@ "sortable" ], "support": { - "source": "https://github.com/Runroom/RunroomSortableBehaviorBundle/tree/0.17.1" + "source": "https://github.com/Runroom/RunroomSortableBehaviorBundle/tree/0.18.0" }, - "time": "2023-07-18T07:45:45+00:00" + "time": "2024-07-09T08:44:46+00:00" }, { "name": "sabre/dav", @@ -10567,84 +10494,6 @@ }, "time": "2024-11-29T19:22:48+00:00" }, - { - "name": "sensio/framework-extra-bundle", - "version": "v6.2.10", - "source": { - "type": "git", - "url": "https://github.com/sensiolabs/SensioFrameworkExtraBundle.git", - "reference": "2f886f4b31f23c76496901acaedfedb6936ba61f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sensiolabs/SensioFrameworkExtraBundle/zipball/2f886f4b31f23c76496901acaedfedb6936ba61f", - "reference": "2f886f4b31f23c76496901acaedfedb6936ba61f", - "shasum": "" - }, - "require": { - "doctrine/annotations": "^1.0|^2.0", - "php": ">=7.2.5", - "symfony/config": "^4.4|^5.0|^6.0", - "symfony/dependency-injection": "^4.4|^5.0|^6.0", - "symfony/framework-bundle": "^4.4|^5.0|^6.0", - "symfony/http-kernel": "^4.4|^5.0|^6.0" - }, - "conflict": { - "doctrine/doctrine-cache-bundle": "<1.3.1", - "doctrine/persistence": "<1.3" - }, - "require-dev": { - "doctrine/dbal": "^2.10|^3.0", - "doctrine/doctrine-bundle": "^1.11|^2.0", - "doctrine/orm": "^2.5", - "symfony/browser-kit": "^4.4|^5.0|^6.0", - "symfony/doctrine-bridge": "^4.4|^5.0|^6.0", - "symfony/dom-crawler": "^4.4|^5.0|^6.0", - "symfony/expression-language": "^4.4|^5.0|^6.0", - "symfony/finder": "^4.4|^5.0|^6.0", - "symfony/monolog-bridge": "^4.0|^5.0|^6.0", - "symfony/monolog-bundle": "^3.2", - "symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0", - "symfony/security-bundle": "^4.4|^5.0|^6.0", - "symfony/twig-bundle": "^4.4|^5.0|^6.0", - "symfony/yaml": "^4.4|^5.0|^6.0", - "twig/twig": "^1.34|^2.4|^3.0" - }, - "type": "symfony-bundle", - "extra": { - "branch-alias": { - "dev-master": "6.1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Sensio\\Bundle\\FrameworkExtraBundle\\": "src/" - }, - "exclude-from-classmap": [ - "/tests/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "This bundle provides a way to configure your controllers with annotations", - "keywords": [ - "annotations", - "controllers" - ], - "support": { - "source": "https://github.com/sensiolabs/SensioFrameworkExtraBundle/tree/v6.2.10" - }, - "abandoned": "Symfony", - "time": "2023-02-24T14:57:12+00:00" - }, { "name": "sentry/sentry", "version": "4.10.0", @@ -17117,25 +16966,26 @@ }, { "name": "symfony/var-exporter", - "version": "v7.2.0", + "version": "v6.4.13", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "1a6a89f95a46af0f142874c9d650a6358d13070d" + "reference": "0f605f72a363f8743001038a176eeb2a11223b51" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/1a6a89f95a46af0f142874c9d650a6358d13070d", - "reference": "1a6a89f95a46af0f142874c9d650a6358d13070d", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/0f605f72a363f8743001038a176eeb2a11223b51", + "reference": "0f605f72a363f8743001038a176eeb2a11223b51", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3" }, "require-dev": { "symfony/property-access": "^6.4|^7.0", "symfony/serializer": "^6.4|^7.0", - "symfony/var-dumper": "^6.4|^7.0" + "symfony/var-dumper": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { @@ -17173,7 +17023,7 @@ "serialize" ], "support": { - "source": "https://github.com/symfony/var-exporter/tree/v7.2.0" + "source": "https://github.com/symfony/var-exporter/tree/v6.4.13" }, "funding": [ { @@ -17189,7 +17039,7 @@ "type": "tidelift" } ], - "time": "2024-10-18T07:58:17+00:00" + "time": "2024-09-25T14:18:03+00:00" }, { "name": "symfony/web-link", @@ -18207,20 +18057,20 @@ "packages-dev": [ { "name": "aeon-php/calendar", - "version": "1.0.9", + "version": "1.0.11", "source": { "type": "git", "url": "https://github.com/aeon-php/calendar.git", - "reference": "2cfc45a2cd28b78f1450d8155a1c62df2efe45de" + "reference": "41f4b0ff07247c36b232ddfbcddc62af738be6fe" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aeon-php/calendar/zipball/2cfc45a2cd28b78f1450d8155a1c62df2efe45de", - "reference": "2cfc45a2cd28b78f1450d8155a1c62df2efe45de", + "url": "https://api.github.com/repos/aeon-php/calendar/zipball/41f4b0ff07247c36b232ddfbcddc62af738be6fe", + "reference": "41f4b0ff07247c36b232ddfbcddc62af738be6fe", "shasum": "" }, "require": { - "php": "~8.1.10 || ~8.2" + "php": "~8.2.0 || ~8.3.0 || ~8.4.0" }, "require-dev": { "ext-bcmath": "*", @@ -18251,9 +18101,19 @@ ], "support": { "issues": "https://github.com/aeon-php/calendar/issues", - "source": "https://github.com/aeon-php/calendar/tree/1.0.9" + "source": "https://github.com/aeon-php/calendar/tree/1.0.11" }, - "time": "2023-08-29T09:47:37+00:00" + "funding": [ + { + "url": "https://flow-php.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/norberttech", + "type": "github" + } + ], + "time": "2025-01-24T04:47:09+00:00" }, { "name": "behat/behat", @@ -22517,20 +22377,20 @@ }, { "name": "symfony/process", - "version": "v7.2.0", + "version": "v6.4.15", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "d34b22ba9390ec19d2dd966c40aa9e8462f27a7e" + "reference": "3cb242f059c14ae08591c5c4087d1fe443564392" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/d34b22ba9390ec19d2dd966c40aa9e8462f27a7e", - "reference": "d34b22ba9390ec19d2dd966c40aa9e8462f27a7e", + "url": "https://api.github.com/repos/symfony/process/zipball/3cb242f059c14ae08591c5c4087d1fe443564392", + "reference": "3cb242f059c14ae08591c5c4087d1fe443564392", "shasum": "" }, "require": { - "php": ">=8.2" + "php": ">=8.1" }, "type": "library", "autoload": { @@ -22558,7 +22418,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.2.0" + "source": "https://github.com/symfony/process/tree/v6.4.15" }, "funding": [ { @@ -22574,7 +22434,7 @@ "type": "tidelift" } ], - "time": "2024-11-06T14:24:19+00:00" + "time": "2024-11-06T14:19:14+00:00" }, { "name": "symfony/web-profiler-bundle", @@ -22866,6 +22726,6 @@ "ext-pdo": "*", "ext-zip": "*" }, - "platform-dev": [], - "plugin-api-version": "2.3.0" + "platform-dev": {}, + "plugin-api-version": "2.6.0" } diff --git a/src/Controller/Admin/AdminCommitteeController.php b/src/Controller/Admin/AdminCommitteeController.php index 96cd4fa56f1..fecadf0fbf3 100644 --- a/src/Controller/Admin/AdminCommitteeController.php +++ b/src/Controller/Admin/AdminCommitteeController.php @@ -22,7 +22,6 @@ use App\Repository\CommitteeRepository; use Doctrine\ORM\EntityManagerInterface; use Psr\Cache\CacheItemPoolInterface; -use DoctrineExtensions\Query\Mysql\Exp; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\ExpressionLanguage\Expression; use Symfony\Component\HttpFoundation\Request; diff --git a/src/Controller/Api/AppLink/AuthenticatedAppLinkController.php b/src/Controller/Api/AppLink/AuthenticatedAppLinkController.php index b8f29b23008..7e085c773ae 100644 --- a/src/Controller/Api/AppLink/AuthenticatedAppLinkController.php +++ b/src/Controller/Api/AppLink/AuthenticatedAppLinkController.php @@ -3,8 +3,6 @@ namespace App\Controller\Api\AppLink; use App\Controller\Renaissance\Adhesion\AdhesionController; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security; -use App\Entity\Adherent; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; diff --git a/src/Controller/Api/Filter/GetCollectionFiltersController.php b/src/Controller/Api/Filter/GetCollectionFiltersController.php index 5205cb934d8..d8829b6569c 100644 --- a/src/Controller/Api/Filter/GetCollectionFiltersController.php +++ b/src/Controller/Api/Filter/GetCollectionFiltersController.php @@ -5,14 +5,15 @@ use App\JMEFilter\FiltersGenerator; use App\Scope\ScopeGeneratorResolver; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\ExpressionLanguage\Expression; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Security\Http\Attribute\IsGranted; +#[IsGranted(new Expression("is_granted('REQUEST_SCOPE_GRANTED', ['contacts', 'messages'])"))] #[Route(path: '/v3/filters', name: 'app_collection_filters_get', methods: ['GET'])] -#[Security("is_granted('REQUEST_SCOPE_GRANTED', ['contacts', 'messages'])")] class GetCollectionFiltersController extends AbstractController { public function __construct( diff --git a/src/Controller/Api/Security/GetJWTTokenController.php b/src/Controller/Api/Security/GetJWTTokenController.php index 7ec4cc517e0..3403c504fb2 100644 --- a/src/Controller/Api/Security/GetJWTTokenController.php +++ b/src/Controller/Api/Security/GetJWTTokenController.php @@ -6,12 +6,13 @@ use App\OAuth\JWTTokenGenerator; use App\Security\Voter\OAuthClientVoter; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\ExpressionLanguage\Expression; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Attribute\Route; use Symfony\Component\Security\Http\Attribute\IsGranted; +#[IsGranted(new Expression("is_granted('REQUEST_SCOPE_GRANTED', 'featurebase')"))] #[Route(path: '/v3/sso/jwt/{uuid}', name: 'api_security_get_jwt_token', methods: ['GET'])] -#[Security("is_granted('REQUEST_SCOPE_GRANTED', 'featurebase')")] class GetJWTTokenController extends AbstractController { public function __invoke(Client $client, JWTTokenGenerator $tokenGenerator): Response diff --git a/src/Controller/Api/UserController.php b/src/Controller/Api/UserController.php index 45a1686441e..9a71b5a558f 100644 --- a/src/Controller/Api/UserController.php +++ b/src/Controller/Api/UserController.php @@ -23,7 +23,6 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Attribute\Route; -use Symfony\Component\Security\Http\Attribute\IsGranted; use Symfony\Component\Serializer\Encoder\JsonEncoder; use Symfony\Component\Serializer\SerializerInterface; use Symfony\Component\Validator\Validator\ValidatorInterface; diff --git a/src/Controller/EnMarche/CommitteeController.php b/src/Controller/EnMarche/CommitteeController.php index 15fa1e0bd12..46d6ffff344 100644 --- a/src/Controller/EnMarche/CommitteeController.php +++ b/src/Controller/EnMarche/CommitteeController.php @@ -10,9 +10,6 @@ use App\Mailchimp\Synchronisation\Command\AdherentChangeCommand; use App\Security\Http\Session\AnonymousFollowerSession; use App\Security\Voter\Committee\ChangeCommitteeVoter; -use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted; -use Doctrine\ORM\EntityManagerInterface; -use Symfony\Bridge\Doctrine\Attribute\MapEntity; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; diff --git a/src/Controller/EnMarche/LegacyController.php b/src/Controller/EnMarche/LegacyController.php deleted file mode 100644 index d663a0032ae..00000000000 --- a/src/Controller/EnMarche/LegacyController.php +++ /dev/null @@ -1,33 +0,0 @@ - '\d+'], methods: ['GET'])] - public function redirectEventAction( - #[MapEntity(expr: 'repository.find(id)')] - CommitteeEvent $event, - ): Response { - return $this->redirectToRoute('app_committee_event_show', [ - 'slug' => $event->getSlug(), - ], Response::HTTP_MOVED_PERMANENTLY); - } - - #[Route(path: '/espaceperso/comite/{id}-{slug}', requirements: ['id' => '\d+'], methods: ['GET'])] - public function redirectCommitteeAction( - #[MapEntity(expr: 'repository.find(id)')] - Committee $committee, - ): Response { - return $this->redirectToRoute('app_committee_show', [ - 'slug' => $committee->getSlug(), - ], Response::HTTP_MOVED_PERMANENTLY); - } -} diff --git a/src/Controller/Renaissance/MyCommittee/SaveCommitteeUpdateController.php b/src/Controller/Renaissance/MyCommittee/SaveCommitteeUpdateController.php index 2374f62604c..5642eca0bac 100644 --- a/src/Controller/Renaissance/MyCommittee/SaveCommitteeUpdateController.php +++ b/src/Controller/Renaissance/MyCommittee/SaveCommitteeUpdateController.php @@ -12,7 +12,6 @@ use Symfony\Component\ExpressionLanguage\Expression; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Attribute\Route; -use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Security\Http\Attribute\IsGranted; #[IsGranted(new Expression('is_granted("ABLE_TO_CHANGE_COMMITTEE") or is_granted("IS_IMPERSONATOR")'))] diff --git a/src/Controller/Renaissance/MyCommittee/ShowCommitteeListController.php b/src/Controller/Renaissance/MyCommittee/ShowCommitteeListController.php index 7b7be70169e..ceb46cf17b0 100644 --- a/src/Controller/Renaissance/MyCommittee/ShowCommitteeListController.php +++ b/src/Controller/Renaissance/MyCommittee/ShowCommitteeListController.php @@ -8,7 +8,6 @@ use Symfony\Component\ExpressionLanguage\Expression; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Attribute\Route; -use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Security\Http\Attribute\IsGranted; #[IsGranted(new Expression('is_granted("ABLE_TO_CHANGE_COMMITTEE") or is_granted("IS_IMPERSONATOR")'))] diff --git a/src/Entity/EntityIdentityTrait.php b/src/Entity/EntityIdentityTrait.php index c76ce0f1530..e21f8ce62f1 100644 --- a/src/Entity/EntityIdentityTrait.php +++ b/src/Entity/EntityIdentityTrait.php @@ -2,7 +2,7 @@ namespace App\Entity; -use ApiPlatform\Core\Annotation\ApiProperty; +use ApiPlatform\Metadata\ApiProperty; use Doctrine\ORM\Mapping as ORM; use Ramsey\Uuid\UuidInterface; use Symfony\Component\Serializer\Attribute\Groups; @@ -35,12 +35,19 @@ trait EntityIdentityTrait 'adherent_message_update_filter', 'audience_list_read', 'audience_read', + 'committee_candidacies_group:write', + 'elected_representative_write', + 'elected_mandate_write', 'audience_segment_read', + 'my_team_member_write', 'cause_read', 'committee:list', + 'committee:update_animator', 'committee:read', 'committee_candidacies_group:read', 'committee_candidacy:read', + 'jecoute_news_write', + 'pap_campaign_history_write', 'committee_election:read', 'contact_read', 'contact_read_after_write', diff --git a/src/Entity/Event/BaseEvent.php b/src/Entity/Event/BaseEvent.php index 1a100f765a3..2602ea541db 100644 --- a/src/Entity/Event/BaseEvent.php +++ b/src/Entity/Event/BaseEvent.php @@ -325,7 +325,7 @@ abstract class BaseEvent implements ReportableInterface, GeoPointInterface, Addr /** * @var EventCategoryInterface|EventCategory|null */ - #[Groups(['event_read', 'event_list_read', 'event_write'])] + #[Groups(['event_read', 'event_list_read', 'event_write', 'event_write_creation'])] #[ORM\ManyToOne(targetEntity: EventCategory::class)] protected $category; diff --git a/src/Entity/Event/BaseEventCategory.php b/src/Entity/Event/BaseEventCategory.php index 1d7270e8b08..738182a6e98 100644 --- a/src/Entity/Event/BaseEventCategory.php +++ b/src/Entity/Event/BaseEventCategory.php @@ -2,7 +2,7 @@ namespace App\Entity\Event; -use ApiPlatform\Core\Annotation\ApiProperty; +use ApiPlatform\Metadata\ApiProperty; use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; use Symfony\Component\Serializer\Attribute\Groups; @@ -33,7 +33,7 @@ abstract class BaseEventCategory implements EventCategoryInterface #[Assert\Length(max: 100)] #[Assert\NotBlank] #[Gedmo\Slug(fields: ['name'], unique: true)] - #[Groups(['event_read', 'event_list_read', 'event_category_read'])] + #[Groups(['event_read', 'event_list_read', 'event_category_read', 'event_write'])] #[ORM\Column(length: 100, unique: true)] protected $slug; diff --git a/src/Entity/Event/EventCategory.php b/src/Entity/Event/EventCategory.php index bc65d139306..93029f05cad 100644 --- a/src/Entity/Event/EventCategory.php +++ b/src/Entity/Event/EventCategory.php @@ -14,7 +14,7 @@ #[ApiResource( operations: [ new Get(), - new GetCollection(uriTemplate: '/event_categories'), + new GetCollection(), ], normalizationContext: ['groups' => ['event_category_read']], order: ['slug' => 'ASC'], diff --git a/src/Entity/Geo/GeoTrait.php b/src/Entity/Geo/GeoTrait.php index 18620bd27a2..0b45de7e970 100644 --- a/src/Entity/Geo/GeoTrait.php +++ b/src/Entity/Geo/GeoTrait.php @@ -2,7 +2,7 @@ namespace App\Entity\Geo; -use ApiPlatform\Core\Annotation\ApiProperty; +use ApiPlatform\Metadata\ApiProperty; use App\Entity\GeoData; use App\Entity\GeoPointTrait; use Doctrine\ORM\Mapping as ORM; diff --git a/src/Normalizer/EntityCategoryFromSlugDenormalizer.php b/src/Normalizer/EntityCategoryFromSlugDenormalizer.php new file mode 100644 index 00000000000..ee31e3e6dd4 --- /dev/null +++ b/src/Normalizer/EntityCategoryFromSlugDenormalizer.php @@ -0,0 +1,36 @@ +repository->findOneBy(['slug' => $data])) { + return $object; + } + + throw new ItemNotFoundException(\sprintf('Category "%s" with slug "%s" not found', $type, $data)); + } + + public function getSupportedTypes(?string $format): array + { + return [ + '*' => true, + ]; + } + + public function supportsDenormalization($data, $type, $format = null, array $context = []): bool + { + return \is_string($data) && EventCategory::class === $type; + } +} diff --git a/symfony.lock b/symfony.lock index 3f7fc500fb9..95b0f4d673d 100644 --- a/symfony.lock +++ b/symfony.lock @@ -37,15 +37,6 @@ "ref": "56eaa387b5e48ebcc7c95a893b47dfa1ad51449c" } }, - "doctrine/annotations": { - "version": "2.0", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "1.10", - "ref": "64d8583af5ea57b7afa4aba4b159907f3a148b05" - } - }, "doctrine/doctrine-bundle": { "version": "2.5", "recipe": { @@ -253,18 +244,6 @@ "config/routes/scheb_2fa.yaml" ] }, - "sensio/framework-extra-bundle": { - "version": "6.2", - "recipe": { - "repo": "github.com/symfony/recipes", - "branch": "main", - "version": "5.2", - "ref": "fb7e19da7f013d0d422fa9bce16f5c510e27609b" - }, - "files": [ - "config/packages/sensio_framework_extra.yaml" - ] - }, "sentry/sentry-symfony": { "version": "4.3", "recipe": { diff --git a/tests/Controller/Admin/SecurityControllerCaseTest.php b/tests/Controller/Admin/SecurityControllerCaseTest.php index b80ce8ddfca..4ce4638c0ac 100644 --- a/tests/Controller/Admin/SecurityControllerCaseTest.php +++ b/tests/Controller/Admin/SecurityControllerCaseTest.php @@ -53,7 +53,6 @@ public function testAuthenticationIfSecretCode(): void $this->assertClientIsRedirectedTo('/login/2fa', $this->client, true); $crawler = $this->client->followRedirect(); - $content = $this->client->getResponse()->getContent(); $this->assertResponseStatusCode(Response::HTTP_OK, $this->client->getResponse()); $this->assertCount(1, $crawler->filter('#_auth_code'));