From f3e42af71cc71960dfbb60a4e63b3993a11ddee6 Mon Sep 17 00:00:00 2001 From: Arthur de Moulins Date: Tue, 12 Sep 2023 11:34:55 +0200 Subject: [PATCH] WIP --- .github/workflows/ci.yaml | 2 +- .../api/src/Api/Model/Output/WorkspaceOutput.php | 14 +++++++++++--- .../WorkspaceOutputTransformer.php | 5 ++++- databox/api/src/Entity/Core/Collection.php | 6 +++--- 4 files changed, 19 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index ef931b202..14c39d9ff 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -288,5 +288,5 @@ jobs: run: | ECR_REGISTRY="${{ steps.login-ecr-public.outputs.registry }}/${REGISTRY_ALIAS}" docker image ls | grep ${{ env.DOCKER_TAG }} | awk '{ print $1 }' | xargs -I {} echo docker tag {}:${{ env.DOCKER_TAG }} {}:${{ github.ref_name }} | sed "s,${{ env.REGISTRY_NAMESPACE }},${ECR_REGISTRY}/ps-,2" | bash - export COMPOSE_PROFILES="${COMPOSE_PROFILES},configurator" REGISTRY_NAMESPACE=${ECR_REGISTRY}/ps- DOCKER_TAG=${{ github.ref_name }} docker compose push + COMPOSE_PROFILES="configurator" REGISTRY_NAMESPACE=${ECR_REGISTRY}/ps- DOCKER_TAG=${{ github.ref_name }} docker compose push diff --git a/databox/api/src/Api/Model/Output/WorkspaceOutput.php b/databox/api/src/Api/Model/Output/WorkspaceOutput.php index 4b8cf5b8e..638e5e43f 100644 --- a/databox/api/src/Api/Model/Output/WorkspaceOutput.php +++ b/databox/api/src/Api/Model/Output/WorkspaceOutput.php @@ -18,17 +18,25 @@ class WorkspaceOutput extends AbstractUuidOutput use CapabilitiesDTOTrait; use CreatedAtDTOTrait; - #[Groups(['_', Workspace::GROUP_LIST, Workspace::GROUP_READ, Collection::GROUP_LIST, Collection::GROUP_READ])] + #[Groups([ + '_', + Workspace::GROUP_LIST, + Workspace::GROUP_READ, + Collection::GROUP_LIST, + Collection::GROUP_READ, + ])] protected array $capabilities = []; - #[Groups([Workspace::GROUP_LIST, + #[Groups([ + Workspace::GROUP_LIST, Workspace::GROUP_READ, Collection::GROUP_LIST, Collection::GROUP_READ, Asset::GROUP_LIST, Asset::GROUP_READ, WebhookSerializationInterface::DEFAULT_GROUP, - RenditionDefinition::GROUP_LIST])] + RenditionDefinition::GROUP_LIST, + ])] private string $name; #[Groups([Workspace::GROUP_LIST, Workspace::GROUP_READ])] diff --git a/databox/api/src/Api/OutputTransformer/WorkspaceOutputTransformer.php b/databox/api/src/Api/OutputTransformer/WorkspaceOutputTransformer.php index 891d1b41a..aca5c36f3 100644 --- a/databox/api/src/Api/OutputTransformer/WorkspaceOutputTransformer.php +++ b/databox/api/src/Api/OutputTransformer/WorkspaceOutputTransformer.php @@ -5,6 +5,7 @@ namespace App\Api\OutputTransformer; use App\Api\Model\Output\WorkspaceOutput; +use App\Entity\Core\Collection; use App\Entity\Core\Workspace; use App\Security\Voter\AbstractVoter; use App\Util\SecurityAwareTrait; @@ -45,7 +46,9 @@ public function transform($data, string $outputClass, array &$context = []): obj } if ($this->hasGroup([ - Workspace::GROUP_READ, + Collection::GROUP_READ, + Collection::GROUP_LIST, + Workspace::GROUP_LIST, Workspace::GROUP_LIST, ], $context)) { $output->setCapabilities($this->capCache[$k]); diff --git a/databox/api/src/Entity/Core/Collection.php b/databox/api/src/Entity/Core/Collection.php index fa21cb2e7..129a40bb7 100644 --- a/databox/api/src/Entity/Core/Collection.php +++ b/databox/api/src/Entity/Core/Collection.php @@ -110,7 +110,7 @@ class Collection extends AbstractUuidEntity implements SoftDeleteableInterface, /** * @var self[] */ - #[ORM\OneToMany(targetEntity: Collection::class, mappedBy: 'parent')] + #[ORM\OneToMany(mappedBy: 'parent', targetEntity: Collection::class)] #[ORM\JoinColumn(nullable: true)] #[MaxDepth(1)] private ?DoctrineCollection $children = null; @@ -120,10 +120,10 @@ class Collection extends AbstractUuidEntity implements SoftDeleteableInterface, */ private ?bool $hasChildren = null; - #[ORM\OneToMany(targetEntity: CollectionAsset::class, mappedBy: 'collection', cascade: ['persist'])] + #[ORM\OneToMany(mappedBy: 'collection', targetEntity: CollectionAsset::class, cascade: ['persist'])] private ?DoctrineCollection $assets = null; - #[ORM\OneToMany(targetEntity: Asset::class, mappedBy: 'referenceCollection')] + #[ORM\OneToMany(mappedBy: 'referenceCollection', targetEntity: Asset::class)] private ?DoctrineCollection $referenceAssets = null; #[ORM\ManyToOne(targetEntity: Workspace::class, inversedBy: 'collections')]