From 5fa52efe9f80e6e15089e5aba42d278c65a13f57 Mon Sep 17 00:00:00 2001 From: Arnaud Fornerot Date: Tue, 4 Oct 2022 09:47:41 +0200 Subject: [PATCH 1/4] fix(manager): add doctrine fixtures --- composer.json | 1 + composer.lock | 167 ++++++++++++++- config/bundles.php | 1 + src/Controller/UserController.php | 4 +- src/DataFixtures/AppFixtures.php | 334 ++++++++++++++++++++++++++++++ src/DataFixtures/niveau01.csv | 4 + src/DataFixtures/niveau02.csv | 7 + src/DataFixtures/niveau03.csv | 13 ++ src/DataFixtures/niveau04.csv | 25 +++ src/Entity/Niveau01.php | 16 +- src/Entity/Niveau02.php | 9 + src/Entity/Niveau03.php | 9 +- src/Entity/Niveau04.php | 8 +- symfony.lock | 12 ++ 14 files changed, 597 insertions(+), 13 deletions(-) create mode 100644 src/DataFixtures/AppFixtures.php create mode 100644 src/DataFixtures/niveau01.csv create mode 100644 src/DataFixtures/niveau02.csv create mode 100644 src/DataFixtures/niveau03.csv create mode 100644 src/DataFixtures/niveau04.csv diff --git a/composer.json b/composer.json index eb693eb..31054d3 100644 --- a/composer.json +++ b/composer.json @@ -121,6 +121,7 @@ } }, "require-dev": { + "doctrine/doctrine-fixtures-bundle": "^3.4", "phpunit/phpunit": "^9.5", "symfony/browser-kit": "6.1.*", "symfony/css-selector": "6.1.*", diff --git a/composer.lock b/composer.lock index 774621f..a103c5e 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": "8d7631f5e9055ef66369d9d0ea7d116e", + "content-hash": "d3be737db4f7ce5089c83be63c8dbf09", "packages": [ { "name": "aws/aws-crt-php", @@ -10931,6 +10931,171 @@ } ], "packages-dev": [ + { + "name": "doctrine/data-fixtures", + "version": "1.5.3", + "source": { + "type": "git", + "url": "https://github.com/doctrine/data-fixtures.git", + "reference": "ba37bfb776de763c5bf04a36d074cd5f5a083c42" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/data-fixtures/zipball/ba37bfb776de763c5bf04a36d074cd5f5a083c42", + "reference": "ba37bfb776de763c5bf04a36d074cd5f5a083c42", + "shasum": "" + }, + "require": { + "doctrine/common": "^2.13|^3.0", + "doctrine/persistence": "^1.3.3|^2.0|^3.0", + "php": "^7.2 || ^8.0" + }, + "conflict": { + "doctrine/dbal": "<2.13", + "doctrine/phpcr-odm": "<1.3.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9.0", + "doctrine/dbal": "^2.13 || ^3.0", + "doctrine/mongodb-odm": "^1.3.0 || ^2.0.0", + "doctrine/orm": "^2.7.0", + "ext-sqlite3": "*", + "jangregor/phpstan-prophecy": "^1", + "phpstan/phpstan": "^1.5", + "phpunit/phpunit": "^8.5 || ^9.5", + "symfony/cache": "^5.0 || ^6.0", + "vimeo/psalm": "^4.10" + }, + "suggest": { + "alcaeus/mongo-php-adapter": "For using MongoDB ODM 1.3 with PHP 7 (deprecated)", + "doctrine/mongodb-odm": "For loading MongoDB ODM fixtures", + "doctrine/orm": "For loading ORM fixtures", + "doctrine/phpcr-odm": "For loading PHPCR ODM fixtures" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Common\\DataFixtures\\": "lib/Doctrine/Common/DataFixtures" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + } + ], + "description": "Data Fixtures for all Doctrine Object Managers", + "homepage": "https://www.doctrine-project.org", + "keywords": [ + "database" + ], + "support": { + "issues": "https://github.com/doctrine/data-fixtures/issues", + "source": "https://github.com/doctrine/data-fixtures/tree/1.5.3" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdata-fixtures", + "type": "tidelift" + } + ], + "time": "2022-04-19T10:01:44+00:00" + }, + { + "name": "doctrine/doctrine-fixtures-bundle", + "version": "3.4.2", + "source": { + "type": "git", + "url": "https://github.com/doctrine/DoctrineFixturesBundle.git", + "reference": "601988c5b46dbd20a0f886f967210aba378a6fd5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/DoctrineFixturesBundle/zipball/601988c5b46dbd20a0f886f967210aba378a6fd5", + "reference": "601988c5b46dbd20a0f886f967210aba378a6fd5", + "shasum": "" + }, + "require": { + "doctrine/data-fixtures": "^1.3", + "doctrine/doctrine-bundle": "^1.11|^2.0", + "doctrine/orm": "^2.6.0", + "doctrine/persistence": "^1.3.7|^2.0|^3.0", + "php": "^7.1 || ^8.0", + "symfony/config": "^3.4|^4.3|^5.0|^6.0", + "symfony/console": "^3.4|^4.3|^5.0|^6.0", + "symfony/dependency-injection": "^3.4.47|^4.3|^5.0|^6.0", + "symfony/doctrine-bridge": "^3.4|^4.1|^5.0|^6.0", + "symfony/http-kernel": "^3.4|^4.3|^5.0|^6.0" + }, + "require-dev": { + "doctrine/coding-standard": "^9", + "phpstan/phpstan": "^1.4.10", + "phpunit/phpunit": "^7.5.20 || ^8.5.26 || ^9.5.20", + "symfony/phpunit-bridge": "^6.0.8", + "vimeo/psalm": "^4.22" + }, + "type": "symfony-bundle", + "autoload": { + "psr-4": { + "Doctrine\\Bundle\\FixturesBundle\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Doctrine Project", + "homepage": "https://www.doctrine-project.org" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony DoctrineFixturesBundle", + "homepage": "https://www.doctrine-project.org", + "keywords": [ + "Fixture", + "persistence" + ], + "support": { + "issues": "https://github.com/doctrine/DoctrineFixturesBundle/issues", + "source": "https://github.com/doctrine/DoctrineFixturesBundle/tree/3.4.2" + }, + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdoctrine-fixtures-bundle", + "type": "tidelift" + } + ], + "time": "2022-04-28T17:58:29+00:00" + }, { "name": "masterminds/html5", "version": "2.7.6", diff --git a/config/bundles.php b/config/bundles.php index 4a87e7a..8287450 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -21,4 +21,5 @@ return [ FOS\RestBundle\FOSRestBundle::class => ['all' => true], Nelmio\ApiDocBundle\NelmioApiDocBundle::class => ['all' => true], Symfony\Bundle\MakerBundle\MakerBundle::class => ['dev' => true], + Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true], ]; diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php index cb975af..2c58c9f 100644 --- a/src/Controller/UserController.php +++ b/src/Controller/UserController.php @@ -72,7 +72,7 @@ class UserController extends AbstractController ->from("App\Entity\UserModo", 'usermodo') ->where('usermodo.niveau01 = entity.niveau01') ->andWhere('usermodo.user = :user') - ->where('entity.isactive = :isactive') + ->andwhere('entity.isactive = :isactive') ->setParameter('isactive', $isactive) ->setParameter('user', $this->getUser()) ->getQuery()->getSingleScalarResult(); @@ -89,7 +89,7 @@ class UserController extends AbstractController ->select('COUNT(entity)') ->from($this->entity, 'entity') ->where('entity.isvisible=true') - ->where('entity.isactive = :isactive') + ->andwhere('entity.isactive = :isactive') ->setParameter('isactive', $isactive); switch ($request->getSession()->get('scopeannu')) { diff --git a/src/DataFixtures/AppFixtures.php b/src/DataFixtures/AppFixtures.php new file mode 100644 index 0000000..2813cc6 --- /dev/null +++ b/src/DataFixtures/AppFixtures.php @@ -0,0 +1,334 @@ +kernel = $kernel; + $this->output = new ConsoleOutput(); + } + + public function load(ObjectManager $manager): void + { + // app:Init + $this->writeln("app:Init"); + $application = new Application($this->kernel); + $application->setAutoExit(false); + $input = new ArrayInput(['command' => 'app:Init']); + $boutput = new BufferedOutput(); + $application->run($input, $boutput); + $manager->flush(); + + // app:Synchro + $manager->clear(); + $this->writeln("app:Synchro"); + $input = new ArrayInput(['command' => 'app:Synchro']); + $boutput = new BufferedOutput(); + $application->run($input, $boutput); + + // Assign id + $metadata = $manager->getClassMetaData('App\Entity\Niveau01'); + $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); + $metadata->setIdGenerator(new AssignedGenerator()); + + $metadata = $manager->getClassMetaData('App\Entity\Niveau02'); + $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); + $metadata->setIdGenerator(new AssignedGenerator()); + + $metadata = $manager->getClassMetaData('App\Entity\Niveau03'); + $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); + $metadata->setIdGenerator(new AssignedGenerator()); + + $metadata = $manager->getClassMetaData('App\Entity\Niveau04'); + $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); + $metadata->setIdGenerator(new AssignedGenerator()); + + // Niveau 01 + $this->writeln("Niveau01"); + $csv = file_get_contents($this->kernel->getProjectDir().'/src/DataFixtures/niveau01.csv'); + $tab = $this->csv_to_array($csv); + foreach($tab as $lig) { + $niveau01=$manager->getRepository('App\Entity\Niveau01')->find($lig['id']); + if(!$niveau01) { + $niveau01=new Niveau01(); + $niveau01->setId($lig["id"]); + $manager->persist($niveau01); + + } + $niveau01->setLabel($lig["label"]); + $niveau01->setCode($lig["code"]); + $niveau01->setPostaladress($lig["postaladress"]); + $niveau01->setTelephonenumber($lig["telephonenumber"]); + $niveau01->setEmail($lig["email"]); + $niveau01->setApikey($lig["apikey"]); + + $manager->flush(); + } + + // Niveau 02 + $this->writeln("Niveau02"); + $csv = file_get_contents($this->kernel->getProjectDir().'/src/DataFixtures/niveau02.csv'); + $tab = $this->csv_to_array($csv); + foreach($tab as $lig) { + $niveau01=$manager->getRepository('App\Entity\Niveau01')->findOneBy(["code"=>$lig['codenv1']]); + if(!$niveau01) continue; + + $niveau02=$manager->getRepository('App\Entity\Niveau02')->find($lig['id']); + if(!$niveau02) { + $niveau02=new Niveau02(); + $niveau02->setId($lig["id"]); + $manager->persist($niveau02); + + } + $niveau02->setLabel($lig["label"]); + $niveau02->setCode($lig["code"]); + $niveau02->setPostaladress($lig["postaladress"]); + $niveau02->setTelephonenumber($lig["telephonenumber"]); + $niveau02->setEmail($lig["email"]); + $niveau02->setApikey($lig["apikey"]); + $niveau02->setNiveau01($niveau01); + + $manager->flush(); + } + + // Niveau 03 + $this->writeln("Niveau03"); + $csv = file_get_contents($this->kernel->getProjectDir().'/src/DataFixtures/niveau03.csv'); + $tab = $this->csv_to_array($csv); + foreach($tab as $lig) { + $niveau02=$manager->getRepository('App\Entity\Niveau02')->findOneBy(["code"=>$lig['codenv2']]); + if(!$niveau02) continue; + + $niveau03=$manager->getRepository('App\Entity\Niveau03')->find($lig['id']); + if(!$niveau03) { + $niveau03=new Niveau03(); + $niveau03->setId($lig["id"]); + $manager->persist($niveau03); + + } + $niveau03->setLabel($lig["label"]); + $niveau03->setCode($lig["code"]); + $niveau03->setPostaladress($lig["postaladress"]); + $niveau03->setTelephonenumber($lig["telephonenumber"]); + $niveau03->setEmail($lig["email"]); + $niveau03->setApikey($lig["apikey"]); + $niveau03->setNiveau02($niveau02); + + $manager->flush(); + } + + // Niveau 04 + $this->writeln("Niveau04"); + $csv = file_get_contents($this->kernel->getProjectDir().'/src/DataFixtures/niveau04.csv'); + $tab = $this->csv_to_array($csv); + foreach($tab as $lig) { + $niveau03=$manager->getRepository('App\Entity\Niveau03')->findOneBy(["code"=>$lig['codenv3']]); + if(!$niveau03) continue; + + $niveau04=$manager->getRepository('App\Entity\Niveau04')->find($lig['id']); + if(!$niveau04) { + $niveau04=new Niveau04(); + $niveau04->setId($lig["id"]); + $manager->persist($niveau04); + } + $niveau04->setLabel($lig["label"]); + $niveau04->setCode($lig["code"]); + $niveau04->setPostaladress($lig["postaladress"]); + $niveau04->setTelephonenumber($lig["telephonenumber"]); + $niveau04->setEmail($lig["email"]); + $niveau04->setApikey($lig["apikey"]); + $niveau04->setNiveau03($niveau03); + + $manager->flush(); + } + + // User MODO + $this->writeln("User Modo"); + $userid=-99; + $usercpt=0; + $niveau01s=$manager->getRepository('App\Entity\Niveau01')->findAll(); + foreach($niveau01s as $niveau01) { + $userid=$userid-1; + $usercpt=$usercpt+1; + $username="modo".str_pad($usercpt,3,"0", STR_PAD_LEFT); + + $user=$manager->getRepository('App\Entity\User')->find($userid); + if(!$user) { + $user=new User(); + $user->setId($userid); + $manager->persist($user); + + $usermodo=new UserModo(); + $usermodo->setUser($user); + $usermodo->setNiveau01($niveau01); + $manager->persist($usermodo); + } + + $user->setUsername($username); + $user->setPassword($username); + $user->setRoles(["ROLE_MODO"]); + $user->setFirstname(str_pad($usercpt,3,"0", STR_PAD_LEFT)); + $user->setLastname("Modo"); + $user->setEmail($username."@noreply.fr"); + $user->setIsvisible(true); + $user->setIsactive(true); + $user->setAvatar("noavatar.png"); + $user->setApikey($username); + $user->setNiveau01($niveau01); + + $manager->flush(); + } + + // User MASTER + $this->writeln("User Master"); + $userid=-199; + $usercpt=0; + $niveau02s=$manager->getRepository('App\Entity\Niveau02')->findAll(); + foreach($niveau02s as $niveau02) { + $userid=$userid-1; + $usercpt=$usercpt+1; + $username="master".str_pad($usercpt,3,"0", STR_PAD_LEFT); + + $user=$manager->getRepository('App\Entity\User')->find($userid); + if(!$user) { + $user=new User(); + $user->setId($userid); + $manager->persist($user); + } + + $user->setUsername($username); + $user->setPassword($username); + $user->setRoles(["ROLE_MASTER"]); + $user->setFirstname(str_pad($usercpt,3,"0", STR_PAD_LEFT)); + $user->setLastname("Master"); + $user->setEmail($username."@noreply.fr"); + $user->setIsvisible(true); + $user->setIsactive(true); + $user->setAvatar("noavatar.png"); + $user->setApikey($username); + $user->setNiveau01($niveau02->getNiveau01()); + $user->setNiveau02($niveau02); + + $manager->flush(); + } + + // User MANAGER + $this->writeln("User Manager"); + $userid=-299; + $usercpt=0; + $niveau03s=$manager->getRepository('App\Entity\Niveau03')->findAll(); + foreach($niveau03s as $niveau03) { + $userid=$userid-1; + $usercpt=$usercpt+1; + $username="manager".str_pad($usercpt,3,"0", STR_PAD_LEFT); + + $user=$manager->getRepository('App\Entity\User')->find($userid); + if(!$user) { + $user=new User(); + $user->setId($userid); + $manager->persist($user); + } + + $user->setUsername($username); + $user->setPassword($username); + $user->setRoles(["ROLE_MANAGER"]); + $user->setFirstname(str_pad($usercpt,3,"0", STR_PAD_LEFT)); + $user->setLastname("Manager"); + $user->setEmail($username."@noreply.fr"); + $user->setIsvisible(true); + $user->setIsactive(true); + $user->setAvatar("noavatar.png"); + $user->setApikey($username); + $user->setNiveau01($niveau03->getNiveau02()->getNiveau01()); + $user->setNiveau02($niveau03->getNiveau02()); + $user->setNiveau03($niveau03); + + $manager->flush(); + } + + // User USER + $this->writeln("User User"); + $userid=-299; + $usercpt=0; + $niveau03s=$manager->getRepository('App\Entity\Niveau03')->findAll(); + foreach($niveau03s as $niveau03) { + $userid=$userid-1; + $usercpt=$usercpt+1; + $username="user".str_pad($usercpt,3,"0", STR_PAD_LEFT); + + $user=$manager->getRepository('App\Entity\User')->find($userid); + if(!$user) { + $user=new User(); + $user->setId($userid); + $manager->persist($user); + } + + $user->setUsername($username); + $user->setPassword($username); + $user->setRoles(["ROLE_USER"]); + $user->setFirstname(str_pad($usercpt,3,"0", STR_PAD_LEFT)); + $user->setLastname("User"); + $user->setEmail($username."@noreply.fr"); + $user->setIsvisible(true); + $user->setIsactive(true); + $user->setAvatar("noavatar.png"); + $user->setApikey($username); + $user->setNiveau01($niveau03->getNiveau02()->getNiveau01()); + $user->setNiveau02($niveau03->getNiveau02()); + $user->setNiveau03($niveau03); + + $manager->flush(); + } + + // app:Synchro + $manager->clear(); + $this->writeln("app:Synchro"); + $input = new ArrayInput(['command' => 'app:Synchro']); + $boutput = new BufferedOutput(); + $application->run($input, $boutput); + } + + private function writeln($string) { + $this->output->writeln(' > '.$string.''); + } + + + private function csv_to_array($csv, $delimiter = ';', $enclosure = '', $escape = '\\', $terminator = "\n") { + $r = array(); + $rows = explode($terminator,trim($csv)); + + $names = array_shift($rows); + $names = str_getcsv($names,$delimiter,$enclosure,$escape); + $nc = count($names); + foreach ($rows as $row) { + if (trim($row)) { + $values = str_getcsv($row,$delimiter,$enclosure,$escape); + if (!$values) $values = array_fill(0,$nc,null); + @$r[] = array_combine($names,$values); + } + } + return $r; + } +} diff --git a/src/DataFixtures/niveau01.csv b/src/DataFixtures/niveau01.csv new file mode 100644 index 0000000..67cbbb1 --- /dev/null +++ b/src/DataFixtures/niveau01.csv @@ -0,0 +1,4 @@ +id;label;code;postaladress;telephonenumber;email;apikey +-1;Nv01;Nv01;;;;Nv01 +-2;Nv02;Nv02;;;;Nv02 +-3;Nv03;Nv03;;;;Nv03 \ No newline at end of file diff --git a/src/DataFixtures/niveau02.csv b/src/DataFixtures/niveau02.csv new file mode 100644 index 0000000..884c2ab --- /dev/null +++ b/src/DataFixtures/niveau02.csv @@ -0,0 +1,7 @@ +id;label;code;postaladress;telephonenumber;email;apikey;codenv1 +-1;Nv01Nv01;Nv01Nv01;;;;Nv01Nv01;Nv01 +-2;Nv01Nv02;Nv01Nv02;;;;Nv01Nv02;Nv01 +-3;Nv02Nv01;Nv02Nv01;;;;Nv02Nv01;Nv02 +-4;Nv02Nv02;Nv02Nv02;;;;Nv02Nv02;Nv02 +-5;Nv03Nv01;Nv03Nv01;;;;Nv03Nv01;Nv03 +-6;Nv03Nv02;Nv03Nv02;;;;Nv03Nv02;Nv03 \ No newline at end of file diff --git a/src/DataFixtures/niveau03.csv b/src/DataFixtures/niveau03.csv new file mode 100644 index 0000000..b0bbafb --- /dev/null +++ b/src/DataFixtures/niveau03.csv @@ -0,0 +1,13 @@ +id;label;code;postaladress;telephonenumber;email;apikey;codenv2 +-1;Nv01Nv01Nv01;Nv01Nv01Nv01;;;;Nv01Nv01Nv01;Nv01Nv01 +-2;Nv01Nv01Nv02;Nv01Nv01Nv02;;;;Nv01Nv01Nv02;Nv01Nv01 +-3;Nv01Nv02Nv01;Nv01Nv02Nv01;;;;Nv01Nv02Nv01;Nv01Nv02 +-4;Nv01Nv02Nv02;Nv01Nv02Nv02;;;;Nv01Nv02Nv02;Nv01Nv02 +-5;Nv02Nv01Nv01;Nv02Nv01Nv01;;;;Nv02Nv01Nv01;Nv02Nv01 +-6;Nv02Nv01Nv02;Nv02Nv01Nv02;;;;Nv02Nv01Nv02;Nv02Nv01 +-7;Nv02Nv02Nv01;Nv02Nv02Nv01;;;;Nv02Nv02Nv01;Nv02Nv02 +-8;Nv02Nv02Nv02;Nv02Nv02Nv02;;;;Nv02Nv02Nv02;Nv02Nv02 +-9;Nv03Nv01Nv01;Nv03Nv01Nv01;;;;Nv03Nv01Nv01;Nv03Nv01 +-10;Nv03Nv01Nv02;Nv03Nv01Nv02;;;;Nv03Nv01Nv02;Nv03Nv01 +-11;Nv03Nv02Nv01;Nv03Nv02Nv01;;;;Nv03Nv02Nv01;Nv03Nv02 +-12;Nv03Nv02Nv02;Nv03Nv02Nv02;;;;Nv03Nv02Nv02;Nv03Nv02 \ No newline at end of file diff --git a/src/DataFixtures/niveau04.csv b/src/DataFixtures/niveau04.csv new file mode 100644 index 0000000..be9d71c --- /dev/null +++ b/src/DataFixtures/niveau04.csv @@ -0,0 +1,25 @@ +id;label;code;postaladress;telephonenumber;email;apikey;codenv3 +-1;Nv01Nv01Nv01Nv01;Nv01Nv01Nv01Nv01;;;;Nv01Nv01Nv01Nv01;Nv01Nv01Nv01 +-2;Nv01Nv01Nv01Nv02;Nv01Nv01Nv01Nv02;;;;Nv01Nv01Nv01Nv02;Nv01Nv01Nv01 +-3;Nv01Nv01Nv02Nv01;Nv01Nv01Nv02Nv01;;;;Nv01Nv01Nv02Nv01;Nv01Nv01Nv02 +-4;Nv01Nv01Nv02Nv02;Nv01Nv01Nv02Nv02;;;;Nv01Nv01Nv02Nv02;Nv01Nv01Nv02 +-5;Nv01Nv02Nv01Nv01;Nv01Nv02Nv01Nv01;;;;Nv01Nv02Nv01Nv01;Nv01Nv02Nv01 +-6;Nv01Nv02Nv01Nv02;Nv01Nv02Nv01Nv02;;;;Nv01Nv02Nv01Nv02;Nv01Nv02Nv01 +-7;Nv01Nv02Nv02Nv01;Nv01Nv02Nv02Nv01;;;;Nv01Nv02Nv02Nv01;Nv01Nv02Nv02 +-8;Nv01Nv02Nv02Nv02;Nv01Nv02Nv02Nv02;;;;Nv01Nv02Nv02Nv02;Nv01Nv02Nv02 +-9;Nv02Nv01Nv01Nv01;Nv02Nv01Nv01Nv01;;;;Nv02Nv01Nv01Nv01;Nv02Nv01Nv01 +-10;Nv02Nv01Nv01Nv02;Nv02Nv01Nv01Nv02;;;;Nv02Nv01Nv01Nv02;Nv02Nv01Nv01 +-11;Nv02Nv01Nv02Nv01;Nv02Nv01Nv02Nv01;;;;Nv02Nv01Nv02Nv01;Nv02Nv01Nv02 +-12;Nv02Nv01Nv02Nv02;Nv02Nv01Nv02Nv02;;;;Nv02Nv01Nv02Nv02;Nv02Nv01Nv02 +-13;Nv02Nv02Nv01Nv01;Nv02Nv02Nv01Nv01;;;;Nv02Nv02Nv01Nv01;Nv02Nv02Nv01 +-14;Nv02Nv02Nv01Nv02;Nv02Nv02Nv01Nv02;;;;Nv02Nv02Nv01Nv02;Nv02Nv02Nv01 +-15;Nv02Nv02Nv02Nv01;Nv02Nv02Nv02Nv01;;;;Nv02Nv02Nv02Nv01;Nv02Nv02Nv02 +-16;Nv02Nv02Nv02Nv02;Nv02Nv02Nv02Nv02;;;;Nv02Nv02Nv02Nv02;Nv02Nv02Nv02 +-17;Nv03Nv01Nv01Nv01;Nv03Nv01Nv01Nv01;;;;Nv03Nv01Nv01Nv01;Nv03Nv01Nv01 +-18;Nv03Nv01Nv01Nv02;Nv03Nv01Nv01Nv02;;;;Nv03Nv01Nv01Nv02;Nv03Nv01Nv01 +-19;Nv03Nv01Nv02Nv01;Nv03Nv01Nv02Nv01;;;;Nv03Nv01Nv02Nv01;Nv03Nv01Nv02 +-20;Nv03Nv01Nv02Nv02;Nv03Nv01Nv02Nv02;;;;Nv03Nv01Nv02Nv02;Nv03Nv01Nv02 +-21;Nv03Nv02Nv01Nv01;Nv03Nv02Nv01Nv01;;;;Nv03Nv02Nv01Nv01;Nv03Nv02Nv01 +-22;Nv03Nv02Nv01Nv02;Nv03Nv02Nv01Nv02;;;;Nv03Nv02Nv01Nv02;Nv03Nv02Nv01 +-23;Nv03Nv02Nv02Nv01;Nv03Nv02Nv02Nv01;;;;Nv03Nv02Nv02Nv01;Nv03Nv02Nv02 +-24;Nv03Nv02Nv02Nv02;Nv03Nv02Nv02Nv02;;;;Nv03Nv02Nv02Nv02;Nv03Nv02Nv02 \ No newline at end of file diff --git a/src/Entity/Niveau01.php b/src/Entity/Niveau01.php index a9ce71f..5cc3e1c 100644 --- a/src/Entity/Niveau01.php +++ b/src/Entity/Niveau01.php @@ -104,14 +104,6 @@ class Niveau01 */ private $modos; - public function __construct() - { - $this->niveau02s = new ArrayCollection(); - $this->registrations = new ArrayCollection(); - $this->users = new ArrayCollection(); - $this->modos = new ArrayCollection(); - } - // == CODE A NE PAS REGENERER public function setId(int $id): self { @@ -121,6 +113,14 @@ class Niveau01 } // == FIN DU CODE A NE PAS REGENERER + public function __construct() + { + $this->niveau02s = new ArrayCollection(); + $this->registrations = new ArrayCollection(); + $this->users = new ArrayCollection(); + $this->modos = new ArrayCollection(); + } + public function getId(): ?int { return $this->id; diff --git a/src/Entity/Niveau02.php b/src/Entity/Niveau02.php index fe2e2b1..da20d00 100644 --- a/src/Entity/Niveau02.php +++ b/src/Entity/Niveau02.php @@ -87,6 +87,15 @@ class Niveau02 */ private $users; + // == CODE A NE PAS REGENERER + public function setId(int $id): self + { + $this->id = $id; + + return $this; + } + // == FIN DU CODE A NE PAS REGENERER + public function __construct() { $this->niveau03s = new ArrayCollection(); diff --git a/src/Entity/Niveau03.php b/src/Entity/Niveau03.php index 4a079f1..01c538a 100644 --- a/src/Entity/Niveau03.php +++ b/src/Entity/Niveau03.php @@ -101,7 +101,14 @@ class Niveau03 return $this; } - // == + + public function setId(int $id): self + { + $this->id = $id; + + return $this; + } + // == FIN DU CODE A NE PAS REGENERER public function __construct() { diff --git a/src/Entity/Niveau04.php b/src/Entity/Niveau04.php index 400c6fb..b2411f2 100644 --- a/src/Entity/Niveau04.php +++ b/src/Entity/Niveau04.php @@ -108,7 +108,13 @@ class Niveau04 return $this; } - // == + public function setId(int $id): self + { + $this->id = $id; + + return $this; + } + // == FIN DU CODE A NE PAS REGENERER public function __construct() { diff --git a/symfony.lock b/symfony.lock index 872629e..1a5825b 100644 --- a/symfony.lock +++ b/symfony.lock @@ -22,6 +22,18 @@ "src/Repository/.gitignore" ] }, + "doctrine/doctrine-fixtures-bundle": { + "version": "3.4", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "main", + "version": "3.0", + "ref": "1f5514cfa15b947298df4d771e694e578d4c204d" + }, + "files": [ + "src/DataFixtures/AppFixtures.php" + ] + }, "doctrine/doctrine-migrations-bundle": { "version": "3.2", "recipe": { -- 2.17.1 From 58518ec70d15b76eec78b3782df78de07a354afa Mon Sep 17 00:00:00 2001 From: Arnaud Fornerot Date: Tue, 4 Oct 2022 11:32:05 +0200 Subject: [PATCH 2/4] fix(manager): manager access && flag isvisible --- .env | 12 ++++--- assets/styles/app.css | 2 +- config/routes.yaml | 31 +++++++++++++++++ config/services.yaml | 2 ++ src/Controller/HomeController.php | 56 +++++++++++++++++++++++++------ src/Controller/UserController.php | 46 +++++++++++++++++++++++-- src/DataFixtures/AppFixtures.php | 2 +- src/Form/UserType.php | 17 ++++++---- src/Service/AppSession.php | 9 ++--- templates/Home/home.html.twig | 8 +++++ templates/User/edit.html.twig | 4 +-- templates/User/list.html.twig | 5 ++- templates/base.html.twig | 4 ++- 13 files changed, 163 insertions(+), 35 deletions(-) diff --git a/.env b/.env index e7c8bc2..49a9c27 100644 --- a/.env +++ b/.env @@ -50,11 +50,13 @@ APP_NIVEAU04MANDATORY='[""]' APP_GROUPUSE=1 APP_GROUPSUBMITER='["ALL"]' -APP_ANNUSCOPEADMIN=ALL -APP_ANNUSCOPEMODO=ALL -APP_ANNUSCOPEMASTER=ALL -APP_ANNUSCOPEMANAGER=ALL -APP_ANNUSCOPEUSER=ALL +APP_ANNUSCOPEADMIN=ALL # ALL or number of niveau view : 1||2||3||4 +APP_ANNUSCOPEMODO=ALL # ALL or number of niveau view : 1||2||3||4 +APP_ANNUSCOPEMASTER=ALL # ALL or number of niveau view : 1||2||3||4 +APP_ANNUSCOPEMANAGER=ALL # ALL or number of niveau view : 1||2||3||4 +APP_ANNUSCOPEUSER=ALL # ALL or number of niveau view : 1||2||3||4 + +APP_USERVIEWISVISIBLE=1 # Profil user with isvisible field # Synchronisation APP_SYNCHRO= # Synchronisation null | LDAP2NINE | NINE2LDAP | NINE2NINE diff --git a/assets/styles/app.css b/assets/styles/app.css index fd2fc5d..7a18471 100644 --- a/assets/styles/app.css +++ b/assets/styles/app.css @@ -8,7 +8,7 @@ body { color: var(--colorfttitledark); } -.header a, #sidebar a, #sidebar hr{ +.header h1, .header a, #sidebar a, #sidebar hr{ color: var(--colorfttitledark); } diff --git a/config/routes.yaml b/config/routes.yaml index 3229ea2..d97162e 100644 --- a/config/routes.yaml +++ b/config/routes.yaml @@ -738,6 +738,37 @@ app_modo_user_delete: controller: App\Controller\UserController::delete defaults: { access: modo } +#-- Access manager +app_manager_user: + path: /manager/user + controller: App\Controller\UserController::list + defaults: { access: manager } + +app_manager_user_tablelist: + path: /manager/user/tablelist + controller: App\Controller\UserController::tablelist + defaults: { access: manager } + +app_manager_user_selectlist: + path: /manager/user/selectlist + controller: App\Controller\UserController::selectlist + defaults: { access: manager } + +app_manager_user_submit: + path: /manager/user/submit + controller: App\Controller\UserController::submit + defaults: { access: manager } + +app_manager_user_update: + path: /manager/user/update/{id} + controller: App\Controller\UserController::update + defaults: { access: manager } + +app_manager_user_delete: + path: /manager/user/delete/{id} + controller: App\Controller\UserController::delete + defaults: { access: manager } + #-- Access all app_all_user: path: /all/update diff --git a/config/services.yaml b/config/services.yaml index fd5ed06..a3e91e4 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -40,6 +40,8 @@ parameters: appAnnuscopemanager: '%env(resolve:APP_ANNUSCOPEMANAGER)%' appAnnuscopeuser: '%env(resolve:APP_ANNUSCOPEUSER)%' + appUserviewisvisible: '%env(resolve:APP_USERVIEWISVISIBLE)%' + appSynchro: '%env(resolve:APP_SYNCHRO)%' appSynchroPurgeNiveau01: '%env(resolve:APP_SYNDCHROPURGENIVEAU01)%' appSynchroPurgeNiveau02: '%env(resolve:APP_SYNDCHROPURGENIVEAU02)%' diff --git a/src/Controller/HomeController.php b/src/Controller/HomeController.php index c43c412..94a28b0 100644 --- a/src/Controller/HomeController.php +++ b/src/Controller/HomeController.php @@ -10,16 +10,36 @@ class HomeController extends AbstractController { public function home(Request $request): Response { - if ($request->getSession()->get('fgforceconnect')) { - return $this->redirectToRoute('app_user_home'); + if ($request->getSession()->get('fgforceconnect')&&!$this->getUser()) { + return $this->redirectToRoute('app_login'); } - return $this->render('Home/home.html.twig', [ - 'useheader' => true, - 'usemenu' => true, - 'usesidebar' => false, - 'maxsize' => 1000, - ]); + if(!$this->getUser()) { + dump("here"); + + return $this->render('Home/home.html.twig', [ + 'useheader' => true, + 'usemenu' => false, + 'usesidebar' => false, + 'maxsize' => 1000, + ]); + } + if ($this->getUser()->hasRole("ROLE_USER")) + return $this->redirectToRoute('app_user_home'); + + if ($this->getUser()->hasRole("ROLE_MANAGER")) + return $this->redirectToRoute('app_manager_home'); + + if ($this->getUser()->hasRole("ROLE_MASTER")) + return $this->redirectToRoute('app_master_home'); + + if ($this->getUser()->hasRole("ROLE_MODO")) + return $this->redirectToRoute('app_modo_home'); + + if ($this->getUser()->hasRole("ROLE_ADMIN")) + return $this->redirectToRoute('app_admin_home'); + + } public function homeuser($access): Response @@ -32,9 +52,19 @@ class HomeController extends AbstractController ]); } - public function homeadmin($access): Response + public function homemaster($access): Response { - return $this->redirectToRoute('app_admin_config'); + return $this->render('Home/home.html.twig', [ + 'useheader' => true, + 'usemenu' => false, + 'usesidebar' => false, + 'maxsize' => 1000, + ]); + } + + public function homemanager($access): Response + { + return $this->redirectToRoute('app_manager_user'); } public function homemodo($access): Response @@ -42,6 +72,12 @@ class HomeController extends AbstractController return $this->redirectToRoute('app_modo_niveau02'); } + public function homeadmin($access): Response + { + return $this->redirectToRoute('app_admin_config'); + } + + public function docrest(): Response { return $this->render('Home/docrest.html.twig', [ diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php index 2c58c9f..e4786b4 100644 --- a/src/Controller/UserController.php +++ b/src/Controller/UserController.php @@ -79,7 +79,8 @@ class UserController extends AbstractController break; default: - $isactive = true; + $isactive = ($access=="manager"?$em->getRepository($this->entity)->getPreference($this->getUser(), 'userisactive', true):true); + $niveau01 = $this->getUser()->getNiveau01(); $niveau02 = $this->getUser()->getNiveau02(); $niveau03 = $this->getUser()->getNiveau03(); @@ -247,7 +248,7 @@ class UserController extends AbstractController } if ($ordercolumn) { - if ('admin' == $access || 'modo' == $access) { + if ('admin' == $access || 'modo' == $access || 'manager' == $access) { $ordercolumn = $ordercolumn - 1; } @@ -298,6 +299,17 @@ class UserController extends AbstractController case 'modo': $action .= "route).'_update', ['id' => $data->getId()])."'>"; break; + case 'manager': + if($this->getUser()->getNiveau03()&&$this->getUser()->getNiveau03()==$data->getNiveau03()) { + $action .= "route).'_update', ['id' => $data->getId()])."'>"; + } + elseif(!$this->getUser()->getNiveau03()&&$this->getUser()->getNiveau02()&&$this->getUser()->getNiveau02()==$data->getNiveau02()) { + $action .= "route).'_update', ['id' => $data->getId()])."'>"; + } + elseif(!$this->getUser()->getNiveau02()&&$this->getUser()->getNiveau01()&&$this->getUser()->getNiveau01()==$data->getNiveau01()) { + $action .= "route).'_update', ['id' => $data->getId()])."'>"; + } + break; } // Groupes @@ -313,7 +325,7 @@ class UserController extends AbstractController } $tmp = []; - if ('admin' == $access || 'modo' == $access) { + if ('admin' == $access || 'modo' == $access || 'manager' == $access) { array_push($tmp, $action); } @@ -381,6 +393,14 @@ class UserController extends AbstractController $data->setIsactive(true); $data->setApikey(Uuid::uuid4()); + // If manager set same niveau to usertosubmit + if($access=="manager") { + $data->setNiveau01($this->getUser()->getNiveau01()); + $data->setNiveau02($this->getUser()->getNiveau02()); + $data->setNiveau03($this->getUser()->getNiveau03()); + $data->setRoles(["ROLE_USER"]); + } + // Création du formulaire $form = $this->createForm(Form::class, $data, [ 'mode' => 'submit', @@ -395,6 +415,7 @@ class UserController extends AbstractController 'appNiveau04use' => $this->GetParameter('appNiveau04use'), 'appNiveau04label' => $this->GetParameter('appNiveau04label'), 'appNiveauupdatable' => $this->GetParameter('appNiveauupdatable'), + 'appUserviewisvisible' => $this->GetParameter('appUserviewisvisible'), ]); // Récupération des data du formulaire @@ -514,6 +535,7 @@ class UserController extends AbstractController 'appNiveau04use' => $this->GetParameter('appNiveau04use'), 'appNiveau04label' => $this->GetParameter('appNiveau04label'), 'appNiveauupdatable' => $this->GetParameter('appNiveauupdatable'), + 'appUserviewisvisible' => $this->GetParameter('appUserviewisvisible'), ]); // Récupération des data du formulaire @@ -678,6 +700,8 @@ class UserController extends AbstractController break; case 'modo': return true; break; + case 'manager': return true; + break; } throw $this->createAccessDeniedException('Permission denied'); } @@ -687,6 +711,7 @@ class UserController extends AbstractController switch ($access) { case 'admin': return true; break; + case 'modo': $usermodo = $em->getRepository("App\Entity\UserModo")->findOneBy(['user' => $this->getUser(), 'niveau01' => $entity->getNiveau01()]); if (!$usermodo) { @@ -695,6 +720,21 @@ class UserController extends AbstractController return true; break; + + case 'manager': + if($this->getUser()->getNiveau03()&&$this->getUser()->getNiveau03()==$entity->getNiveau03()) { + return true; + } + elseif($this->getUser()->getNiveau02()&&$this->getUser()->getNiveau02()==$entity->getNiveau02()) { + return true; + } + elseif($this->getUser()->getNiveau01()&&$this->getUser()->getNiveau01()==$entity->getNiveau01()) { + return true; + } + + throw $this->createAccessDeniedException('Permission denied'); + break; + case 'all': if ($this->getUser()->getId() != $entity->getId()) { throw $this->createAccessDeniedException('Permission denied'); diff --git a/src/DataFixtures/AppFixtures.php b/src/DataFixtures/AppFixtures.php index 2813cc6..08063b0 100644 --- a/src/DataFixtures/AppFixtures.php +++ b/src/DataFixtures/AppFixtures.php @@ -270,7 +270,7 @@ class AppFixtures extends Fixture // User USER $this->writeln("User User"); - $userid=-299; + $userid=-399; $usercpt=0; $niveau03s=$manager->getRepository('App\Entity\Niveau03')->findAll(); foreach($niveau03s as $niveau03) { diff --git a/src/Form/UserType.php b/src/Form/UserType.php index 1975f43..3cd3a93 100644 --- a/src/Form/UserType.php +++ b/src/Form/UserType.php @@ -181,13 +181,15 @@ class UserType extends AbstractType ); } - $choices = ['oui' => '1', 'non' => '0']; - $builder->add('isvisible', - ChoiceType::class, [ - 'label' => 'Visible', - 'choices' => $choices, - ] - ); + if(($access!="all"&&$access!="manager")||$options["appUserviewisvisible"]) { + $choices = ['oui' => '1', 'non' => '0']; + $builder->add('isvisible', + ChoiceType::class, [ + 'label' => 'Visible', + 'choices' => $choices, + ] + ); + } $builder->add('postaladress', TextareaType::class, [ @@ -285,6 +287,7 @@ class UserType extends AbstractType 'appNiveau04use' => 'string', 'appNiveau04label' => 'string', 'appNiveauupdatable' => 'string', + 'appUserviewisvisible' => 'string', ]); } } diff --git a/src/Service/AppSession.php b/src/Service/AppSession.php index aeea678..8723829 100644 --- a/src/Service/AppSession.php +++ b/src/Service/AppSession.php @@ -44,6 +44,11 @@ class AppSession $session->set('colorbgbodydark-darkrgb', $this->hexToRgb($session->get('colorbgbodydark-darker'))); $session->set('colorbgbodydark-lightrgb', $this->hexToRgb($session->get('colorbgbodydark-lighter'))); + // Préférence par défaut + $session->set('fgheader', true); + $session->set('fgaudit', false); + + // Current user $token = $this->token->getToken(); if (!$token) { @@ -51,10 +56,6 @@ class AppSession } $curentuser = $token->getUser(); - // Préférence par défaut - $session->set('fgheader', true); - $session->set('fgaudit', false); - // Préférence if ('anon.' != $curentuser) { $preference = $curentuser->getPreference(); diff --git a/templates/Home/home.html.twig b/templates/Home/home.html.twig index 3cbebe8..0174599 100644 --- a/templates/Home/home.html.twig +++ b/templates/Home/home.html.twig @@ -13,5 +13,13 @@ {{ render(path("app_publish_sample",{id:2})) }} + {% else %} +
+ +

{{app.session.get('appname')}}

+
{{app.session.get('appdescription')|raw}}
+
{% endif %} + + {% endblock %} diff --git a/templates/User/edit.html.twig b/templates/User/edit.html.twig index 1cbdee0..3c4992a 100755 --- a/templates/User/edit.html.twig +++ b/templates/User/edit.html.twig @@ -11,7 +11,7 @@ {% block body %} {{ form_start(form) }}

- {% if access=="admin" or access=="modo" %} + {% if access=="admin" or access=="modo" or access=="manager" %} {% if mode=="update" %} Modification Utilisateur = {{ user.username}} {% else %} @@ -191,7 +191,7 @@ {{ form_row(form.firstname) }} {{ form_row(form.lastname) }} {{ form_row(form.email) }} - {{ form_row(form.isvisible) }} + {%if form.isvisible is defined %}{{ form_row(form.isvisible) }}{%endif%} diff --git a/templates/User/list.html.twig b/templates/User/list.html.twig index bd1e525..ffa31c8 100644 --- a/templates/User/list.html.twig +++ b/templates/User/list.html.twig @@ -29,7 +29,7 @@ - {% if access=="admin" or access=="modo"%} + {% if access=="admin" or access=="modo" or access=="manager"%} {% endif %} @@ -67,6 +67,9 @@ {% elseif access=="modo" %} order: [[ 2, "asc" ]], ajax: "{{ path('app_modo_user_tablelist') }}", + {% elseif access=="manager" %} + order: [[ 2, "asc" ]], + ajax: "{{ path('app_manager_user_tablelist') }}", {% else %} order: [[ 1, "asc" ]], ajax: "{{ path('app_all_user_tablelist') }}", diff --git a/templates/base.html.twig b/templates/base.html.twig index 986dd59..b81294d 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -3,6 +3,8 @@ {% block title %}{{app.session.get("appname")}}{% endblock %} + + @@ -33,7 +35,7 @@ {{app.session.get("appname")}}
- {{app.session.get("appsubname")}} + {{app.session.get("appsubname")}}
-- 2.17.1 From 681b2f6547254967854c526ecf55492ccc6148c1 Mon Sep 17 00:00:00 2001 From: Arnaud Fornerot Date: Tue, 4 Oct 2022 11:55:50 +0200 Subject: [PATCH 3/4] fix(manager): cs fixer --- src/Controller/HomeController.php | 26 +-- src/Controller/UserController.php | 30 ++- src/DataFixtures/AppFixtures.php | 336 +++++++++++++++--------------- src/Entity/Niveau02.php | 2 +- src/Form/UserType.php | 2 +- src/Service/AppSession.php | 1 - 6 files changed, 200 insertions(+), 197 deletions(-) diff --git a/src/Controller/HomeController.php b/src/Controller/HomeController.php index 94a28b0..a610fe4 100644 --- a/src/Controller/HomeController.php +++ b/src/Controller/HomeController.php @@ -10,12 +10,12 @@ class HomeController extends AbstractController { public function home(Request $request): Response { - if ($request->getSession()->get('fgforceconnect')&&!$this->getUser()) { + if ($request->getSession()->get('fgforceconnect') && !$this->getUser()) { return $this->redirectToRoute('app_login'); } - if(!$this->getUser()) { - dump("here"); + if (!$this->getUser()) { + dump('here'); return $this->render('Home/home.html.twig', [ 'useheader' => true, @@ -24,22 +24,25 @@ class HomeController extends AbstractController 'maxsize' => 1000, ]); } - if ($this->getUser()->hasRole("ROLE_USER")) + if ($this->getUser()->hasRole('ROLE_USER')) { return $this->redirectToRoute('app_user_home'); + } - if ($this->getUser()->hasRole("ROLE_MANAGER")) + if ($this->getUser()->hasRole('ROLE_MANAGER')) { return $this->redirectToRoute('app_manager_home'); - - if ($this->getUser()->hasRole("ROLE_MASTER")) + } + + if ($this->getUser()->hasRole('ROLE_MASTER')) { return $this->redirectToRoute('app_master_home'); + } - if ($this->getUser()->hasRole("ROLE_MODO")) + if ($this->getUser()->hasRole('ROLE_MODO')) { return $this->redirectToRoute('app_modo_home'); + } - if ($this->getUser()->hasRole("ROLE_ADMIN")) + if ($this->getUser()->hasRole('ROLE_ADMIN')) { return $this->redirectToRoute('app_admin_home'); - - + } } public function homeuser($access): Response @@ -77,7 +80,6 @@ class HomeController extends AbstractController return $this->redirectToRoute('app_admin_config'); } - public function docrest(): Response { return $this->render('Home/docrest.html.twig', [ diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php index e4786b4..2b2d567 100644 --- a/src/Controller/UserController.php +++ b/src/Controller/UserController.php @@ -79,7 +79,7 @@ class UserController extends AbstractController break; default: - $isactive = ($access=="manager"?$em->getRepository($this->entity)->getPreference($this->getUser(), 'userisactive', true):true); + $isactive = ('manager' == $access ? $em->getRepository($this->entity)->getPreference($this->getUser(), 'userisactive', true) : true); $niveau01 = $this->getUser()->getNiveau01(); $niveau02 = $this->getUser()->getNiveau02(); @@ -300,13 +300,11 @@ class UserController extends AbstractController $action .= "route).'_update', ['id' => $data->getId()])."'>"; break; case 'manager': - if($this->getUser()->getNiveau03()&&$this->getUser()->getNiveau03()==$data->getNiveau03()) { + if ($this->getUser()->getNiveau03() && $this->getUser()->getNiveau03() == $data->getNiveau03()) { $action .= "route).'_update', ['id' => $data->getId()])."'>"; - } - elseif(!$this->getUser()->getNiveau03()&&$this->getUser()->getNiveau02()&&$this->getUser()->getNiveau02()==$data->getNiveau02()) { + } elseif (!$this->getUser()->getNiveau03() && $this->getUser()->getNiveau02() && $this->getUser()->getNiveau02() == $data->getNiveau02()) { $action .= "route).'_update', ['id' => $data->getId()])."'>"; - } - elseif(!$this->getUser()->getNiveau02()&&$this->getUser()->getNiveau01()&&$this->getUser()->getNiveau01()==$data->getNiveau01()) { + } elseif (!$this->getUser()->getNiveau02() && $this->getUser()->getNiveau01() && $this->getUser()->getNiveau01() == $data->getNiveau01()) { $action .= "route).'_update', ['id' => $data->getId()])."'>"; } break; @@ -394,11 +392,11 @@ class UserController extends AbstractController $data->setApikey(Uuid::uuid4()); // If manager set same niveau to usertosubmit - if($access=="manager") { + if ('manager' == $access) { $data->setNiveau01($this->getUser()->getNiveau01()); $data->setNiveau02($this->getUser()->getNiveau02()); $data->setNiveau03($this->getUser()->getNiveau03()); - $data->setRoles(["ROLE_USER"]); + $data->setRoles(['ROLE_USER']); } // Création du formulaire @@ -711,7 +709,7 @@ class UserController extends AbstractController switch ($access) { case 'admin': return true; break; - + case 'modo': $usermodo = $em->getRepository("App\Entity\UserModo")->findOneBy(['user' => $this->getUser(), 'niveau01' => $entity->getNiveau01()]); if (!$usermodo) { @@ -722,16 +720,14 @@ class UserController extends AbstractController break; case 'manager': - if($this->getUser()->getNiveau03()&&$this->getUser()->getNiveau03()==$entity->getNiveau03()) { + if ($this->getUser()->getNiveau03() && $this->getUser()->getNiveau03() == $entity->getNiveau03()) { + return true; + } elseif ($this->getUser()->getNiveau02() && $this->getUser()->getNiveau02() == $entity->getNiveau02()) { + return true; + } elseif ($this->getUser()->getNiveau01() && $this->getUser()->getNiveau01() == $entity->getNiveau01()) { return true; } - elseif($this->getUser()->getNiveau02()&&$this->getUser()->getNiveau02()==$entity->getNiveau02()) { - return true; - } - elseif($this->getUser()->getNiveau01()&&$this->getUser()->getNiveau01()==$entity->getNiveau01()) { - return true; - } - + throw $this->createAccessDeniedException('Permission denied'); break; diff --git a/src/DataFixtures/AppFixtures.php b/src/DataFixtures/AppFixtures.php index 08063b0..0b9c2d6 100644 --- a/src/DataFixtures/AppFixtures.php +++ b/src/DataFixtures/AppFixtures.php @@ -2,22 +2,21 @@ namespace App\DataFixtures; -use Doctrine\Bundle\FixturesBundle\Fixture; -use Doctrine\Persistence\ObjectManager; -use Symfony\Bundle\FrameworkBundle\Console\Application; -use Symfony\Component\HttpKernel\KernelInterface; -use Symfony\Component\Console\Input\ArrayInput; -use Symfony\Component\Console\Output\BufferedOutput; -use Symfony\Component\Console\Output\ConsoleOutput; -use Doctrine\ORM\Id\AssignedGenerator; -use Doctrine\ORM\Mapping\ClassMetadata; - use App\Entity\Niveau01; use App\Entity\Niveau02; use App\Entity\Niveau03; use App\Entity\Niveau04; use App\Entity\User; use App\Entity\UserModo; +use Doctrine\Bundle\FixturesBundle\Fixture; +use Doctrine\ORM\Id\AssignedGenerator; +use Doctrine\ORM\Mapping\ClassMetadata; +use Doctrine\Persistence\ObjectManager; +use Symfony\Bundle\FrameworkBundle\Console\Application; +use Symfony\Component\Console\Input\ArrayInput; +use Symfony\Component\Console\Output\BufferedOutput; +use Symfony\Component\Console\Output\ConsoleOutput; +use Symfony\Component\HttpKernel\KernelInterface; class AppFixtures extends Fixture { @@ -33,7 +32,7 @@ class AppFixtures extends Fixture public function load(ObjectManager $manager): void { // app:Init - $this->writeln("app:Init"); + $this->writeln('app:Init'); $application = new Application($this->kernel); $application->setAutoExit(false); $input = new ArrayInput(['command' => 'app:Init']); @@ -43,158 +42,161 @@ class AppFixtures extends Fixture // app:Synchro $manager->clear(); - $this->writeln("app:Synchro"); + $this->writeln('app:Synchro'); $input = new ArrayInput(['command' => 'app:Synchro']); $boutput = new BufferedOutput(); - $application->run($input, $boutput); + $application->run($input, $boutput); // Assign id $metadata = $manager->getClassMetaData('App\Entity\Niveau01'); $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); $metadata->setIdGenerator(new AssignedGenerator()); - + $metadata = $manager->getClassMetaData('App\Entity\Niveau02'); $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); $metadata->setIdGenerator(new AssignedGenerator()); - + $metadata = $manager->getClassMetaData('App\Entity\Niveau03'); $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); $metadata->setIdGenerator(new AssignedGenerator()); - + $metadata = $manager->getClassMetaData('App\Entity\Niveau04'); $metadata->setIdGeneratorType(ClassMetadata::GENERATOR_TYPE_NONE); $metadata->setIdGenerator(new AssignedGenerator()); // Niveau 01 - $this->writeln("Niveau01"); + $this->writeln('Niveau01'); $csv = file_get_contents($this->kernel->getProjectDir().'/src/DataFixtures/niveau01.csv'); $tab = $this->csv_to_array($csv); - foreach($tab as $lig) { - $niveau01=$manager->getRepository('App\Entity\Niveau01')->find($lig['id']); - if(!$niveau01) { - $niveau01=new Niveau01(); - $niveau01->setId($lig["id"]); + foreach ($tab as $lig) { + $niveau01 = $manager->getRepository('App\Entity\Niveau01')->find($lig['id']); + if (!$niveau01) { + $niveau01 = new Niveau01(); + $niveau01->setId($lig['id']); $manager->persist($niveau01); - } - $niveau01->setLabel($lig["label"]); - $niveau01->setCode($lig["code"]); - $niveau01->setPostaladress($lig["postaladress"]); - $niveau01->setTelephonenumber($lig["telephonenumber"]); - $niveau01->setEmail($lig["email"]); - $niveau01->setApikey($lig["apikey"]); + $niveau01->setLabel($lig['label']); + $niveau01->setCode($lig['code']); + $niveau01->setPostaladress($lig['postaladress']); + $niveau01->setTelephonenumber($lig['telephonenumber']); + $niveau01->setEmail($lig['email']); + $niveau01->setApikey($lig['apikey']); $manager->flush(); } // Niveau 02 - $this->writeln("Niveau02"); + $this->writeln('Niveau02'); $csv = file_get_contents($this->kernel->getProjectDir().'/src/DataFixtures/niveau02.csv'); $tab = $this->csv_to_array($csv); - foreach($tab as $lig) { - $niveau01=$manager->getRepository('App\Entity\Niveau01')->findOneBy(["code"=>$lig['codenv1']]); - if(!$niveau01) continue; - - $niveau02=$manager->getRepository('App\Entity\Niveau02')->find($lig['id']); - if(!$niveau02) { - $niveau02=new Niveau02(); - $niveau02->setId($lig["id"]); - $manager->persist($niveau02); - + foreach ($tab as $lig) { + $niveau01 = $manager->getRepository('App\Entity\Niveau01')->findOneBy(['code' => $lig['codenv1']]); + if (!$niveau01) { + continue; } - $niveau02->setLabel($lig["label"]); - $niveau02->setCode($lig["code"]); - $niveau02->setPostaladress($lig["postaladress"]); - $niveau02->setTelephonenumber($lig["telephonenumber"]); - $niveau02->setEmail($lig["email"]); - $niveau02->setApikey($lig["apikey"]); + + $niveau02 = $manager->getRepository('App\Entity\Niveau02')->find($lig['id']); + if (!$niveau02) { + $niveau02 = new Niveau02(); + $niveau02->setId($lig['id']); + $manager->persist($niveau02); + } + $niveau02->setLabel($lig['label']); + $niveau02->setCode($lig['code']); + $niveau02->setPostaladress($lig['postaladress']); + $niveau02->setTelephonenumber($lig['telephonenumber']); + $niveau02->setEmail($lig['email']); + $niveau02->setApikey($lig['apikey']); $niveau02->setNiveau01($niveau01); $manager->flush(); } // Niveau 03 - $this->writeln("Niveau03"); + $this->writeln('Niveau03'); $csv = file_get_contents($this->kernel->getProjectDir().'/src/DataFixtures/niveau03.csv'); $tab = $this->csv_to_array($csv); - foreach($tab as $lig) { - $niveau02=$manager->getRepository('App\Entity\Niveau02')->findOneBy(["code"=>$lig['codenv2']]); - if(!$niveau02) continue; - - $niveau03=$manager->getRepository('App\Entity\Niveau03')->find($lig['id']); - if(!$niveau03) { - $niveau03=new Niveau03(); - $niveau03->setId($lig["id"]); - $manager->persist($niveau03); - + foreach ($tab as $lig) { + $niveau02 = $manager->getRepository('App\Entity\Niveau02')->findOneBy(['code' => $lig['codenv2']]); + if (!$niveau02) { + continue; } - $niveau03->setLabel($lig["label"]); - $niveau03->setCode($lig["code"]); - $niveau03->setPostaladress($lig["postaladress"]); - $niveau03->setTelephonenumber($lig["telephonenumber"]); - $niveau03->setEmail($lig["email"]); - $niveau03->setApikey($lig["apikey"]); + + $niveau03 = $manager->getRepository('App\Entity\Niveau03')->find($lig['id']); + if (!$niveau03) { + $niveau03 = new Niveau03(); + $niveau03->setId($lig['id']); + $manager->persist($niveau03); + } + $niveau03->setLabel($lig['label']); + $niveau03->setCode($lig['code']); + $niveau03->setPostaladress($lig['postaladress']); + $niveau03->setTelephonenumber($lig['telephonenumber']); + $niveau03->setEmail($lig['email']); + $niveau03->setApikey($lig['apikey']); $niveau03->setNiveau02($niveau02); $manager->flush(); } // Niveau 04 - $this->writeln("Niveau04"); + $this->writeln('Niveau04'); $csv = file_get_contents($this->kernel->getProjectDir().'/src/DataFixtures/niveau04.csv'); $tab = $this->csv_to_array($csv); - foreach($tab as $lig) { - $niveau03=$manager->getRepository('App\Entity\Niveau03')->findOneBy(["code"=>$lig['codenv3']]); - if(!$niveau03) continue; + foreach ($tab as $lig) { + $niveau03 = $manager->getRepository('App\Entity\Niveau03')->findOneBy(['code' => $lig['codenv3']]); + if (!$niveau03) { + continue; + } - $niveau04=$manager->getRepository('App\Entity\Niveau04')->find($lig['id']); - if(!$niveau04) { - $niveau04=new Niveau04(); - $niveau04->setId($lig["id"]); + $niveau04 = $manager->getRepository('App\Entity\Niveau04')->find($lig['id']); + if (!$niveau04) { + $niveau04 = new Niveau04(); + $niveau04->setId($lig['id']); $manager->persist($niveau04); } - $niveau04->setLabel($lig["label"]); - $niveau04->setCode($lig["code"]); - $niveau04->setPostaladress($lig["postaladress"]); - $niveau04->setTelephonenumber($lig["telephonenumber"]); - $niveau04->setEmail($lig["email"]); - $niveau04->setApikey($lig["apikey"]); + $niveau04->setLabel($lig['label']); + $niveau04->setCode($lig['code']); + $niveau04->setPostaladress($lig['postaladress']); + $niveau04->setTelephonenumber($lig['telephonenumber']); + $niveau04->setEmail($lig['email']); + $niveau04->setApikey($lig['apikey']); $niveau04->setNiveau03($niveau03); $manager->flush(); } // User MODO - $this->writeln("User Modo"); - $userid=-99; - $usercpt=0; - $niveau01s=$manager->getRepository('App\Entity\Niveau01')->findAll(); - foreach($niveau01s as $niveau01) { - $userid=$userid-1; - $usercpt=$usercpt+1; - $username="modo".str_pad($usercpt,3,"0", STR_PAD_LEFT); + $this->writeln('User Modo'); + $userid = -99; + $usercpt = 0; + $niveau01s = $manager->getRepository('App\Entity\Niveau01')->findAll(); + foreach ($niveau01s as $niveau01) { + $userid = $userid - 1; + $usercpt = $usercpt + 1; + $username = 'modo'.str_pad($usercpt, 3, '0', STR_PAD_LEFT); - $user=$manager->getRepository('App\Entity\User')->find($userid); - if(!$user) { - $user=new User(); + $user = $manager->getRepository('App\Entity\User')->find($userid); + if (!$user) { + $user = new User(); $user->setId($userid); $manager->persist($user); - $usermodo=new UserModo(); + $usermodo = new UserModo(); $usermodo->setUser($user); $usermodo->setNiveau01($niveau01); $manager->persist($usermodo); } - + $user->setUsername($username); $user->setPassword($username); - $user->setRoles(["ROLE_MODO"]); - $user->setFirstname(str_pad($usercpt,3,"0", STR_PAD_LEFT)); - $user->setLastname("Modo"); - $user->setEmail($username."@noreply.fr"); + $user->setRoles(['ROLE_MODO']); + $user->setFirstname(str_pad($usercpt, 3, '0', STR_PAD_LEFT)); + $user->setLastname('Modo'); + $user->setEmail($username.'@noreply.fr'); $user->setIsvisible(true); $user->setIsactive(true); - $user->setAvatar("noavatar.png"); + $user->setAvatar('noavatar.png'); $user->setApikey($username); $user->setNiveau01($niveau01); @@ -202,31 +204,31 @@ class AppFixtures extends Fixture } // User MASTER - $this->writeln("User Master"); - $userid=-199; - $usercpt=0; - $niveau02s=$manager->getRepository('App\Entity\Niveau02')->findAll(); - foreach($niveau02s as $niveau02) { - $userid=$userid-1; - $usercpt=$usercpt+1; - $username="master".str_pad($usercpt,3,"0", STR_PAD_LEFT); + $this->writeln('User Master'); + $userid = -199; + $usercpt = 0; + $niveau02s = $manager->getRepository('App\Entity\Niveau02')->findAll(); + foreach ($niveau02s as $niveau02) { + $userid = $userid - 1; + $usercpt = $usercpt + 1; + $username = 'master'.str_pad($usercpt, 3, '0', STR_PAD_LEFT); - $user=$manager->getRepository('App\Entity\User')->find($userid); - if(!$user) { - $user=new User(); + $user = $manager->getRepository('App\Entity\User')->find($userid); + if (!$user) { + $user = new User(); $user->setId($userid); $manager->persist($user); } - + $user->setUsername($username); $user->setPassword($username); - $user->setRoles(["ROLE_MASTER"]); - $user->setFirstname(str_pad($usercpt,3,"0", STR_PAD_LEFT)); - $user->setLastname("Master"); - $user->setEmail($username."@noreply.fr"); + $user->setRoles(['ROLE_MASTER']); + $user->setFirstname(str_pad($usercpt, 3, '0', STR_PAD_LEFT)); + $user->setLastname('Master'); + $user->setEmail($username.'@noreply.fr'); $user->setIsvisible(true); $user->setIsactive(true); - $user->setAvatar("noavatar.png"); + $user->setAvatar('noavatar.png'); $user->setApikey($username); $user->setNiveau01($niveau02->getNiveau01()); $user->setNiveau02($niveau02); @@ -235,31 +237,31 @@ class AppFixtures extends Fixture } // User MANAGER - $this->writeln("User Manager"); - $userid=-299; - $usercpt=0; - $niveau03s=$manager->getRepository('App\Entity\Niveau03')->findAll(); - foreach($niveau03s as $niveau03) { - $userid=$userid-1; - $usercpt=$usercpt+1; - $username="manager".str_pad($usercpt,3,"0", STR_PAD_LEFT); + $this->writeln('User Manager'); + $userid = -299; + $usercpt = 0; + $niveau03s = $manager->getRepository('App\Entity\Niveau03')->findAll(); + foreach ($niveau03s as $niveau03) { + $userid = $userid - 1; + $usercpt = $usercpt + 1; + $username = 'manager'.str_pad($usercpt, 3, '0', STR_PAD_LEFT); - $user=$manager->getRepository('App\Entity\User')->find($userid); - if(!$user) { - $user=new User(); + $user = $manager->getRepository('App\Entity\User')->find($userid); + if (!$user) { + $user = new User(); $user->setId($userid); $manager->persist($user); } - + $user->setUsername($username); $user->setPassword($username); - $user->setRoles(["ROLE_MANAGER"]); - $user->setFirstname(str_pad($usercpt,3,"0", STR_PAD_LEFT)); - $user->setLastname("Manager"); - $user->setEmail($username."@noreply.fr"); + $user->setRoles(['ROLE_MANAGER']); + $user->setFirstname(str_pad($usercpt, 3, '0', STR_PAD_LEFT)); + $user->setLastname('Manager'); + $user->setEmail($username.'@noreply.fr'); $user->setIsvisible(true); $user->setIsactive(true); - $user->setAvatar("noavatar.png"); + $user->setAvatar('noavatar.png'); $user->setApikey($username); $user->setNiveau01($niveau03->getNiveau02()->getNiveau01()); $user->setNiveau02($niveau03->getNiveau02()); @@ -269,31 +271,31 @@ class AppFixtures extends Fixture } // User USER - $this->writeln("User User"); - $userid=-399; - $usercpt=0; - $niveau03s=$manager->getRepository('App\Entity\Niveau03')->findAll(); - foreach($niveau03s as $niveau03) { - $userid=$userid-1; - $usercpt=$usercpt+1; - $username="user".str_pad($usercpt,3,"0", STR_PAD_LEFT); + $this->writeln('User User'); + $userid = -399; + $usercpt = 0; + $niveau03s = $manager->getRepository('App\Entity\Niveau03')->findAll(); + foreach ($niveau03s as $niveau03) { + $userid = $userid - 1; + $usercpt = $usercpt + 1; + $username = 'user'.str_pad($usercpt, 3, '0', STR_PAD_LEFT); - $user=$manager->getRepository('App\Entity\User')->find($userid); - if(!$user) { - $user=new User(); + $user = $manager->getRepository('App\Entity\User')->find($userid); + if (!$user) { + $user = new User(); $user->setId($userid); $manager->persist($user); } - + $user->setUsername($username); $user->setPassword($username); - $user->setRoles(["ROLE_USER"]); - $user->setFirstname(str_pad($usercpt,3,"0", STR_PAD_LEFT)); - $user->setLastname("User"); - $user->setEmail($username."@noreply.fr"); + $user->setRoles(['ROLE_USER']); + $user->setFirstname(str_pad($usercpt, 3, '0', STR_PAD_LEFT)); + $user->setLastname('User'); + $user->setEmail($username.'@noreply.fr'); $user->setIsvisible(true); $user->setIsactive(true); - $user->setAvatar("noavatar.png"); + $user->setAvatar('noavatar.png'); $user->setApikey($username); $user->setNiveau01($niveau03->getNiveau02()->getNiveau01()); $user->setNiveau02($niveau03->getNiveau02()); @@ -304,31 +306,35 @@ class AppFixtures extends Fixture // app:Synchro $manager->clear(); - $this->writeln("app:Synchro"); + $this->writeln('app:Synchro'); $input = new ArrayInput(['command' => 'app:Synchro']); $boutput = new BufferedOutput(); - $application->run($input, $boutput); + $application->run($input, $boutput); } - private function writeln($string) { - $this->output->writeln(' > '.$string.''); + private function writeln($string) + { + $this->output->writeln(' > '.$string.''); } + private function csv_to_array($csv, $delimiter = ';', $enclosure = '', $escape = '\\', $terminator = "\n") + { + $r = []; + $rows = explode($terminator, trim($csv)); - private function csv_to_array($csv, $delimiter = ';', $enclosure = '', $escape = '\\', $terminator = "\n") { - $r = array(); - $rows = explode($terminator,trim($csv)); + $names = array_shift($rows); + $names = str_getcsv($names, $delimiter, $enclosure, $escape); + $nc = count($names); + foreach ($rows as $row) { + if (trim($row)) { + $values = str_getcsv($row, $delimiter, $enclosure, $escape); + if (!$values) { + $values = array_fill(0, $nc, null); + } + @$r[] = array_combine($names, $values); + } + } - $names = array_shift($rows); - $names = str_getcsv($names,$delimiter,$enclosure,$escape); - $nc = count($names); - foreach ($rows as $row) { - if (trim($row)) { - $values = str_getcsv($row,$delimiter,$enclosure,$escape); - if (!$values) $values = array_fill(0,$nc,null); - @$r[] = array_combine($names,$values); - } - } - return $r; - } + return $r; + } } diff --git a/src/Entity/Niveau02.php b/src/Entity/Niveau02.php index da20d00..fcd93d1 100644 --- a/src/Entity/Niveau02.php +++ b/src/Entity/Niveau02.php @@ -95,7 +95,7 @@ class Niveau02 return $this; } // == FIN DU CODE A NE PAS REGENERER - + public function __construct() { $this->niveau03s = new ArrayCollection(); diff --git a/src/Form/UserType.php b/src/Form/UserType.php index 3cd3a93..f3e39b3 100644 --- a/src/Form/UserType.php +++ b/src/Form/UserType.php @@ -181,7 +181,7 @@ class UserType extends AbstractType ); } - if(($access!="all"&&$access!="manager")||$options["appUserviewisvisible"]) { + if (('all' != $access && 'manager' != $access) || $options['appUserviewisvisible']) { $choices = ['oui' => '1', 'non' => '0']; $builder->add('isvisible', ChoiceType::class, [ diff --git a/src/Service/AppSession.php b/src/Service/AppSession.php index 8723829..6f50938 100644 --- a/src/Service/AppSession.php +++ b/src/Service/AppSession.php @@ -48,7 +48,6 @@ class AppSession $session->set('fgheader', true); $session->set('fgaudit', false); - // Current user $token = $this->token->getToken(); if (!$token) { -- 2.17.1 From 6c720ed62ade307d03b879855df537e26dee7f64 Mon Sep 17 00:00:00 2001 From: Arnaud Fornerot Date: Tue, 4 Oct 2022 12:00:24 +0200 Subject: [PATCH 4/4] fix(manager): phpstan --- src/Controller/HomeController.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Controller/HomeController.php b/src/Controller/HomeController.php index a610fe4..df0d8c7 100644 --- a/src/Controller/HomeController.php +++ b/src/Controller/HomeController.php @@ -8,15 +8,13 @@ use Symfony\Component\HttpFoundation\Response; class HomeController extends AbstractController { - public function home(Request $request): Response + public function home(Request $request) { if ($request->getSession()->get('fgforceconnect') && !$this->getUser()) { return $this->redirectToRoute('app_login'); } if (!$this->getUser()) { - dump('here'); - return $this->render('Home/home.html.twig', [ 'useheader' => true, 'usemenu' => false, -- 2.17.1
Action