From 364be2420bb086305cdd779ff77f0567b69aa7d2 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Mon, 4 Jan 2021 13:54:38 +0100 Subject: [PATCH] Applied API role specs to short URL creation when findIfExists is provided --- module/Core/src/Repository/ShortUrlRepository.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/module/Core/src/Repository/ShortUrlRepository.php b/module/Core/src/Repository/ShortUrlRepository.php index d4bb1d16..ddfaa189 100644 --- a/module/Core/src/Repository/ShortUrlRepository.php +++ b/module/Core/src/Repository/ShortUrlRepository.php @@ -234,6 +234,11 @@ class ShortUrlRepository extends EntitySpecificationRepository implements ShortU ->setParameter('domain', $meta->getDomain()); } + $apiKey = $meta->getApiKey(); + if ($apiKey !== null) { + $this->applySpecification($qb, $apiKey->spec(), 's'); + } + $tagsAmount = count($tags); if ($tagsAmount === 0) { return $qb->getQuery()->getOneOrNullResult();