diff --git a/api/src/Entity/DownloadJob.php b/api/src/Entity/DownloadJob.php index 1883a7a..8a12057 100644 --- a/api/src/Entity/DownloadJob.php +++ b/api/src/Entity/DownloadJob.php @@ -38,7 +38,6 @@ processor: DownloadJobQueuedProcessor::class ), new Get( - security: "object.owner == user" ), new GetCollection( order: ['createdAt' => 'DESC'], diff --git a/api/src/Entity/DownloadJobEvent.php b/api/src/Entity/DownloadJobEvent.php index e27e1b0..ffc626a 100644 --- a/api/src/Entity/DownloadJobEvent.php +++ b/api/src/Entity/DownloadJobEvent.php @@ -10,6 +10,7 @@ use App\Interface\OwnerFilterableInterface; use App\Repository\DownloadJobEventRepository; use Doctrine\ORM\Mapping as ORM; +use Doctrine\ORM\Query\Expr\Join; use Doctrine\ORM\QueryBuilder; use Gedmo\Timestampable\Traits\TimestampableEntity; @@ -175,7 +176,12 @@ public static function getOwnerQueryBuilder(QueryBuilder $queryBuilder, string $ { $rootAlias = $queryBuilder->getRootAliases()[0]; return $queryBuilder - ->andWhere('download_job.owner = :owner') + ->innerJoin( + sprintf('%s.downloadJob', $rootAlias), + 'dj', + Join::INNER_JOIN + ) + ->andWhere('dj.owner = :owner') ->setParameter('owner', $ownerIdentifier); } } diff --git a/api/src/Entity/DownloadedFile.php b/api/src/Entity/DownloadedFile.php index 343ee07..6fd86bc 100644 --- a/api/src/Entity/DownloadedFile.php +++ b/api/src/Entity/DownloadedFile.php @@ -13,12 +13,12 @@ use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\QueryBuilder; -use Symfony\Component\Serializer\Annotation\Groups; +use Symfony\Component\Serializer\Attribute\Groups; #[ApiResource( uriTemplate: '/download_jobs/{downloadJobUuid}/files.{_format}', operations: [new GetCollection( - normalizationContext: ['groups' => ['downloadedFile:read']] +// normalizationContext: ['groups' => ['downloadedFile:read']] )], uriVariables: [ 'downloadJobUuid' => new Link(