From 55e34b75264fa5c81eabe032cb8a66d27a4ac930 Mon Sep 17 00:00:00 2001 From: afornerot Date: Wed, 3 Mar 2021 17:40:02 +0100 Subject: [PATCH 1/2] =?UTF-8?q?mise=20=C3=A0=20niveau=20appkernel=20par=20?= =?UTF-8?q?rapport=20=C3=A0=20composer.json=20(fixes=20#31626)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ninegate-1.0/app/AppKernel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ninegate-1.0/app/AppKernel.php b/src/ninegate-1.0/app/AppKernel.php index 3fd2ba0a..60868ae1 100644 --- a/src/ninegate-1.0/app/AppKernel.php +++ b/src/ninegate-1.0/app/AppKernel.php @@ -16,7 +16,6 @@ class AppKernel extends Kernel new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(), new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), - new \Symfony\Bundle\MakerBundle\MakerBundle(), new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(), new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(), new Symfony\Bundle\AsseticBundle\AsseticBundle(), @@ -47,6 +46,7 @@ class AppKernel extends Kernel $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); + $bundles[] = new Symfony\Bundle\MakerBundle\MakerBundle(); if ('dev' === $this->getEnvironment()) { $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); From 3c47ed1d400c376c6235f20deaa8019ba4bfdc55 Mon Sep 17 00:00:00 2001 From: afornerot Date: Wed, 3 Mar 2021 18:04:00 +0100 Subject: [PATCH 2/2] =?UTF-8?q?supprimer=20des=20bookmark=20les=20items=20?= =?UTF-8?q?qui=20ne=20sont=20plus=20li=C3=A9=20au=20profil=20(fixes=20#312?= =?UTF-8?q?69)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PortalBundle/Repository/ItemRepository.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/ninegate-1.0/src/Cadoles/PortalBundle/Repository/ItemRepository.php b/src/ninegate-1.0/src/Cadoles/PortalBundle/Repository/ItemRepository.php index 46c7016a..6ec3aadd 100644 --- a/src/ninegate-1.0/src/Cadoles/PortalBundle/Repository/ItemRepository.php +++ b/src/ninegate-1.0/src/Cadoles/PortalBundle/Repository/ItemRepository.php @@ -34,6 +34,7 @@ class ItemRepository extends EntityRepository $items=new ArrayCollection(); // Récupération des items par rôles + $itemsroles=[]; foreach($roles as $role) { $qb = $this->getEntityManager()->createQueryBuilder(); $qb->select('item') @@ -57,6 +58,7 @@ class ItemRepository extends EntityRepository } // Récupération des items par group + $itemsgroups=[]; foreach($groups as $group) { $qb = $this->getEntityManager()->createQueryBuilder(); $qb->select('item') @@ -75,7 +77,6 @@ class ItemRepository extends EntityRepository } $itemsgroups=$qb->getQuery()->getResult(); - foreach($itemsgroups as $itemgroup) { if(!$bookmarksitems->contains($itemgroup) && !$items->contains($itemgroup)) $items->add($itemgroup); } @@ -83,6 +84,7 @@ class ItemRepository extends EntityRepository // Récupération des items par niveau01 + $itemsniveau01s=[]; if($niveau01) { $qb = $this->getEntityManager()->createQueryBuilder(); $qb->select('item') @@ -107,6 +109,7 @@ class ItemRepository extends EntityRepository } // Récupération des items par ssoitem + $itemsssoitems=[]; foreach($ssoitems as $ssoitem) { $qb = $this->getEntityManager()->createQueryBuilder(); $qb->select('item') @@ -125,12 +128,22 @@ class ItemRepository extends EntityRepository } $itemsssoitems=$qb->getQuery()->getResult(); - foreach($itemsssoitems as $itemssoitem) { if(!$bookmarksitems->contains($itemssoitem) && !$items->contains($itemssoitem)) $items->add($itemssoitem); } } + // Pour chaque bookmark lié à un item : on vérifie qu'il est tjr la permission de voir cet item sinon on l'enlève de ses fav + foreach($bookmarks as $key => $bookmark) { + $item=$bookmark->getItem(); + if($item) { + if(!in_array($item,$itemsroles) && !in_array($item,$itemsgroups) && !in_array($item,$itemsniveau01s) && !in_array($item,$itemsssoitems) ) { + unset($bookmarks[$key]); + } + } + } + + // Trie des items $itemsordered = $items->getIterator(); $itemsordered->uasort(function ($first, $second) {