Skip to content

Commit

Permalink
Merge pull request #4 from pimcore/0x-First-Prototype
Browse files Browse the repository at this point in the history
First prototype for FE
  • Loading branch information
alexz707 authored Feb 8, 2024
2 parents 96f7c16 + b8a6b9a commit ec07853
Show file tree
Hide file tree
Showing 28 changed files with 1,018 additions and 115 deletions.
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pimcore/studio-api-bundle",
"license": "Pimcore Enterprise License (PEL)",
"license": "proprietary",
"type": "pimcore-bundle",
"description": "Pimcore Studio Api Bundle",
"config": {
Expand All @@ -18,11 +18,13 @@
"minimum-stability": "dev",
"require": {
"php": "~8.1.0 || ~8.2.0",
"pimcore/enterprise-subscription-tools": "^1.3",
"pimcore/static-resolver-bundle": "^1.3",
"pimcore/generic-data-index-bundle": "1.x-dev",
"pimcore/pimcore": "^11.0",
"api-platform/core": "^3.2"
},
"require-dev": {
"pimcore/admin-ui-classic-bundle": "^v1.3",
"roave/security-advisories": "dev-latest",
"codeception/codeception": "^5.0.10",
"codeception/phpunit-wrapper": "^9",
Expand Down
41 changes: 18 additions & 23 deletions config/api_platform/resources/asset.yaml
Original file line number Diff line number Diff line change
@@ -1,31 +1,26 @@
resources:
Pimcore\Model\Asset:
Pimcore\Bundle\StudioApiBundle\Dto\Asset:
operations:
ApiPlatform\Metadata\GetCollection:
filters: [ Pimcore\Bundle\StudioApiBundle\Filter\AssetParentIdFilter ]
paginationClientItemsPerPage: true
ApiPlatform\Metadata\Get:
normalizationContext:
groups: [ 'asset:read', 'asset:item:get', 'dependency:read', 'property:read']
ApiPlatform\Metadata\Put:
ApiPlatform\Metadata\Post:
ApiPlatform\Metadata\Delete:
ApiPlatform\Metadata\Patch:
provider: Pimcore\Bundle\StudioApiBundle\State\AssetProvider
normalizationContext:
groups: ['get']
groups: ['asset:read', 'dependency:read', 'property:read']
denormalizationContext:
groups: ['set']
groups: ['asset:write']
properties:
id:
identifier: true
parentId: ~
type: ~
data: ~
fullPath: ~

Pimcore\Model\Asset\Image:
provider: Pimcore\Bundle\StudioApiBundle\State\AssetProvider
properties:
id:
identifier: true
normalizationContext:
groups: ['get']
denormalizationContext:
groups: ['set']

Pimcore\Model\Asset\Image\Thumbnail:
provider: Pimcore\Bundle\StudioApiBundle\State\AssetProvider
normalizationContext:
groups: ['get']
denormalizationContext:
groups: ['set']
properties:
Pimcore\Bundle\StudioApiBundle\Dto\Asset:
dependencies:
genId: false
10 changes: 10 additions & 0 deletions config/api_platform/resources/asset/image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resources:
Pimcore\Bundle\StudioApiBundle\Dto\Asset\Image:
provider: Pimcore\Bundle\StudioApiBundle\State\AssetProvider
properties:
id:
identifier: true
normalizationContext:
groups: ['image:read', 'asset:read', 'task:read', 'dependency:read', 'property:read', 'version:read']
denormalizationContext:
groups: ['image:write', 'asset:write']
10 changes: 10 additions & 0 deletions config/api_platform/resources/schedule/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resources:
Pimcore\Bundle\StudioApiBundle\Dto\Task:
provider: Pimcore\Bundle\StudioApiBundle\State\ScheduledTaskProvider
normalizationContext:
groups: ['task:read']
denormalizationContext:
groups: ['task:write']
properties:
id:
identifier: true
5 changes: 0 additions & 5 deletions config/api_platform/resources/user.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@ resources:
input: Pimcore\Bundle\StudioApiBundle\Dto\ResetPasswordRequest
output: false
uriTemplate: '/users/reset-password'
# ApiPlatform\Metadata\Get:
# controller: ApiPlatform\Action\NotFoundAction
# read: false
# output: false


normalizationContext:
groups: [ 'get' ]
Expand Down
16 changes: 16 additions & 0 deletions config/api_platform/resources/version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
resources:
Pimcore\Bundle\StudioApiBundle\Dto\Version:
operations:
ApiPlatform\Metadata\Get:
ApiPlatform\Metadata\Put:
ApiPlatform\Metadata\Post:
ApiPlatform\Metadata\Delete:
ApiPlatform\Metadata\Patch:
provider: Pimcore\Bundle\StudioApiBundle\State\VersionProvider
normalizationContext:
groups: ['version:read']
denormalizationContext:
groups: ['version:write']
properties:
id:
identifier: true
70 changes: 27 additions & 43 deletions config/serialization/asset.yaml
Original file line number Diff line number Diff line change
@@ -1,64 +1,48 @@
Pimcore\Model\Asset:
Pimcore\Bundle\StudioApiBundle\Dto\Asset:
attributes:
id:
groups: ['get', 'bla:read']
groups: ['asset:read']
parentId:
groups: ['get']
groups: ['asset:read']
permissions:
groups: [ 'asset:read' ]
type:
groups: ['get']
groups: ['asset:read']
children:
groups: ['asset:read']
filename:
groups: ['get']
groups: ['asset:read']
path:
groups: ['get']
groups: ['asset:read']
mimetype:
groups: ['get']
groups: ['asset:read']
creationDate:
groups: ['get']
groups: ['asset:read']
modificationDate:
groups: ['get']
groups: ['asset:read']
userOwner:
groups: ['get']
groups: ['asset:read']
userModification:
groups: ['get']
groups: ['asset:read']
properties:
groups: ['get']
groups: ['asset:item:get']
versions:
groups: ['get']
groups: ['asset:read']
metadata:
groups: ['get']
groups: ['asset:read']
locked:
groups: ['get']
groups: ['asset:read']
lock:
groups: ['asset:read']
customSettings:
groups: ['get']
groups: ['asset:item:get']
hasMetaData:
groups: ['get']
groups: ['asset:read']
dependencies:
groups: ['get']
groups: ['asset:item:get']
scheduledTasks:
groups: ['get']
groups: ['asset:item:get']
versionCount:
groups: ['get']
groups: ['asset:item:get']
fullPath:
groups: ['get']

Pimcore\Model\Asset\Image:
attributes:
thumbnail:
groups: ['get']
format:
groups: ['get']
dimensions:
groups: ['get']
width:
groups: [ 'get' ]
height:
groups: [ 'get' ]

Pimcore\Model\Asset\Image\Thumbnail:
attributes:
path:
groups: ['get']
imageTag:
groups: ['get']
media:
groups: ['get']
groups: ['asset:read']
20 changes: 20 additions & 0 deletions config/serialization/asset/image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Pimcore\Bundle\StudioApiBundle\Dto\Asset\Image:
attributes:
thumbnail:
groups: ['image:read']
format:
groups: ['image:read']
dimensions:
groups: ['image:read']
width:
groups: ['image:read']
height:
groups: ['image:read']
animated:
groups: ['image:read']
vectorGraphic:
groups: ['image:read']
lowQualityPreviewDataUri:
groups: ['image:read']
lowQualityPreviewPath:
groups: ['image:read']
20 changes: 20 additions & 0 deletions config/serialization/asset/permissions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Pimcore\Bundle\StudioApiBundle\Dto\Asset\Permissions:
attributes:
list:
groups: ['asset:read']
view:
groups: ['asset:read']
publish:
groups: ['asset:read']
delete:
groups: ['asset:read']
rename:
groups: ['asset:read']
create:
groups: ['asset:read']
settings:
groups: ['asset:read']
versions:
groups: ['asset:read']
properties:
groups: ['asset:read']
16 changes: 16 additions & 0 deletions config/serialization/dependency.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Pimcore\Model\Dependency:
attributes:
sourceId:
groups: ['dependency:read']
sourceType:
groups: ['dependency:read']
required:
groups: ['dependency:read']
requiredByTotalCount:
groups: ['dependency:read']
requiresTotalCount:
groups: ['dependency:read']
requires:
groups: ['dependency:read']
requiredBy:
groups: ['dependency:read']
18 changes: 18 additions & 0 deletions config/serialization/property.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Pimcore\Bundle\StudioApiBundle\Dto\Property:
attributes:
name:
groups: ['property:read']
data:
groups: ['property:read']
type:
groups: ['property:read']
ctype:
groups: ['property:read']
cpath:
groups: ['property:read']
cid:
groups: ['property:read']
inheritable:
groups: ['property:read']
inherited:
groups: ['property:read']
18 changes: 18 additions & 0 deletions config/serialization/schedule/task.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Pimcore\Bundle\StudioApiBundle\Dto\Task:
attributes:
id:
groups: ['task:read', 'task:write']
cid:
groups: ['task:read', 'task:write']
ctype:
groups: ['task:read', 'task:write']
date:
groups: ['task:read', 'task:write']
action:
groups: ['task:read', 'task:write']
version:
groups: ['task:read', 'task:write']
active:
groups: ['task:read', 'task:write']
userId:
groups: ['task:read', 'task:write']
32 changes: 32 additions & 0 deletions config/serialization/version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Pimcore\Bundle\StudioApiBundle\Dto\Version:
attributes:
id:
groups: ['version:read', 'asset:item:get']
cid:
groups: ['version:read', 'asset:item:get']
ctype:
groups: ['version:read', 'asset:item:get']
userId:
groups: ['version:read', 'asset:item:get']
user:
groups: ['version:read', 'asset:item:get']
note:
groups: ['version:read', 'asset:item:get']
date:
groups: ['version:read', 'asset:item:get']
data:
groups: ['version:read']
public:
groups: ['version:read', 'asset:item:get']
serialized:
groups: ['version:read', 'asset:item:get']
versionCount:
groups: ['version:read', 'asset:item:get']
binaryFileHash:
groups: ['version:read', 'asset:item:get']
binaryFileId:
groups: ['version:read', 'asset:item:get']
autosave:
groups: ['version:read', 'asset:item:get']
storageType:
groups: ['version:read', 'asset:item:get']
12 changes: 11 additions & 1 deletion config/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,19 @@ services:
public: true
tags: [ 'controller.service_arguments' ]

# Providers
Pimcore\Bundle\StudioApiBundle\State\AssetProvider: ~
Pimcore\Bundle\StudioApiBundle\State\ScheduledTaskProvider: ~
Pimcore\Bundle\StudioApiBundle\State\VersionProvider: ~

# Processors
Pimcore\Bundle\StudioApiBundle\State\ResetPasswordProcessor: ~

# Filters
Pimcore\Bundle\StudioApiBundle\Filter\AssetParentIdFilter:
tags: [ 'api_platform.filter' ]

# Normalizers
Pimcore\Bundle\StudioApiBundle\Serializer\AssetNormalizer:
tags:
- { name: 'serializer.normalizer' }
- { name: 'serializer.normalizer' }
5 changes: 4 additions & 1 deletion src/DependencyInjection/PimcoreStudioApiExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ public function load(array $configs, ContainerBuilder $container): void
}

// Pass the configuration to the custom normalizer
$container->setParameter('pimcore_studio_api.serializer.mapping.paths', $config['serializer']['mapping']['paths']);
$container->setParameter(
'pimcore_studio_api.serializer.mapping.paths',
$config['serializer']['mapping']['paths']
);
}

public function prepend(ContainerBuilder $container): void
Expand Down
Loading

0 comments on commit ec07853

Please sign in to comment.