Skip to content

Commit

Permalink
Add images use generic search index only (#7)
Browse files Browse the repository at this point in the history
* Add images use generic search index only

* Apply php-cs-fixer changes

* Fix issues, update to new generic data index version

* Apply php-cs-fixer changes

* Fix issues, update to new generic data index version

* Add folder filter

* Apply php-cs-fixer changes

* Add issue template

* Add icon to serializer

* Add csv icon, fix default icons

* Update min php version to 8.2

* Update min php version to 8.2

* Update min php version to 8.2

* Update min php version to 8.2

* Add AssetPathFilter, add Search object

* Apply php-cs-fixer changes

* qodana fixes

* Update License Information (#11)

* Update license info

* Apply php-cs-fixer changes

---------

Co-authored-by: mattamon <[email protected]>

* Authentication / Authorization (#9)

* Initial authorization prototype

* Remove unsued constant

* Refactor to post request and introduce services

* Change isAllowed method

* Always run cs fixer on pull requests

* Apply php-cs-fixer changes

* Add dto, processor and security service test

* Fix variable names

* Apply php-cs-fixer changes

* Apply php-cs-fixer changes

* Add Token Voter

* Apply php-cs-fixer changes

* Refine Voter system

* Apply php-cs-fixer changes

* Do not add to assets yet

* Make requeststack as a param

* Add bearer access token in docs via decorator, disable webby

* Apply php-cs-fixer changes

* Use fully qualified name

* Apply php-cs-fixer changes

* Add qodana baseline

* Exclude qodana.sarif.json to be inspected

---------

Co-authored-by: mattamon <[email protected]>

* Translation endpoint (#10)

* Initial draft

* Add checks and add default language

* Introduce translatorservice

* Follow conventions

* Add translator service test

* Add processor test

* Remove semi-colon

* Add dto translation test

* Add public voter

* Apply php-cs-fixer changes

* Add security service

* Apply php-cs-fixer changes

* Disable public voter for frontend testing

* Shorten lines

---------

Co-authored-by: mattamon <[email protected]>

* Fix generic data index changes

* Fix generic data index changes

* Apply php-cs-fixer changes

* Set reporting level to 6

* Update to getBoolean

* Adding version node

* Cleanup

* Remove type from metadata

* Remove type from serialization

* Add exceptions

* Refactor runtimexceptions to exceptions

* Add high efferent coupling and code duplication to baseline

---------

Co-authored-by: alexz707 <[email protected]>
Co-authored-by: Matthias Schuhmayer <[email protected]>
Co-authored-by: mattamon <[email protected]>
Co-authored-by: mattamon <[email protected]>
  • Loading branch information
5 people authored Mar 7, 2024
1 parent d44e6fe commit 337b5da
Show file tree
Hide file tree
Showing 136 changed files with 42,504 additions and 445 deletions.
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/Bug-Report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Bug Report
description: File a bug report
title: "[Bug]: "
labels: [Bug]
body:
- type: input
attributes:
label: Studio API version
validations:
required: true
- type: textarea
attributes:
label: Steps to reproduce
validations:
required: true
- type: textarea
attributes:
label: Actual Behavior
validations:
required: true
- type: textarea
attributes:
label: Expected Behavior
validations:
required: true
3 changes: 1 addition & 2 deletions .github/workflows/codeception.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ jobs:
strategy:
matrix:
include:
- { php-version: 8.1, dependencies: lowest, pimcore_version: "", experimental: false }
- { php-version: 8.2, dependencies: highest, pimcore_version: "", experimental: false }
- { php-version: 8.2, dependencies: lowest, pimcore_version: "", experimental: false }

steps:
- name: "Checkout code"
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/php-cs-fixer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ name: "PHP-CS-Fixer"
on:
pull_request:
branches:
- "[0-9]+.[0-9]+"
- "[0-9]+.x"
- "feature-*"
- "*"
push:
branches:
- "[0-9]+.[0-9]+"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/qodana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ on:
- '*'
- '**'

version: 1.0
jobs:
qodana:
timeout-minutes: 15
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/static-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ jobs:
strategy:
matrix:
include:
- { php-version: "8.1", dependencies: "lowest", experimental: false }
- { php-version: "8.2", dependencies: "highest", experimental: false }
- { php-version: "8.2", dependencies: "highest", pimcore_version: "11.x-dev as 11.99.9", experimental: true }
steps:
Expand Down
7 changes: 5 additions & 2 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@
'header_comment' => [
'comment_type' => 'PHPDoc',
'header' => 'Pimcore' . PHP_EOL . PHP_EOL .
'This source file is available under following license:' . PHP_EOL .
'This source file is available under two different licenses:' . PHP_EOL .
'- GNU General Public License version 3 (GPLv3)' . PHP_EOL .
'- Pimcore Commercial License (PCL)' . PHP_EOL .
'Full copyright and license information is available in' . PHP_EOL .
'LICENSE.md which is distributed with this source code.' . PHP_EOL .
PHP_EOL .
' @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org)' . PHP_EOL .
' @license http://www.pimcore.org/license PCL'
' @license http://www.pimcore.org/license GPLv3 and PCL'
],

'blank_line_before_statement' => true,
Expand Down
31 changes: 28 additions & 3 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,36 @@
# License
Copyright (C) Pimcore GmbH

This software is available under following license:
This software is available under two different licenses:
* GNU General Public License version 3 (GPLv3) as Pimcore Community Edition
* Pimcore Commercial License (PCL)

The default Pimcore license, without a valid Pimcore Commercial License agreement, is the Open-Source GPLv3 license.

## GNU General Public License version 3 (GPLv3)
If you decide to choose the GPLv3 license, you must comply with the following terms:

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

## Pimcore Commercial License (PCL)
Commercial and supported versions of the program - also known as
Alternatively, commercial and supported versions of the program - also known as
Commercial Distributions - must be used in accordance with the terms and conditions
contained in a separate written agreement between you and Pimcore GmbH.
For more information about the Pimcore Commercial License (PCL) please contact [email protected].
For more information about the Pimcore Commercial License (PCL) please contact [email protected].



Please see also (files in this directory):
- [Licensing FAQ - license-faq.md](https://github.com/pimcore/pimcore/blob/master/license-faq.md)
- [GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - gpl-3.0.txt](gpl-3.0.txt)
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"prefer-stable": true,
"minimum-stability": "dev",
"require": {
"php": "~8.1.0 || ~8.2.0",
"php": "~8.2",
"pimcore/static-resolver-bundle": "^1.3",
"pimcore/generic-data-index-bundle": "1.x-dev",
"pimcore/pimcore": "^11.0",
Expand All @@ -30,7 +30,7 @@
"codeception/phpunit-wrapper": "^9",
"codeception/module-asserts": "^2",
"codeception/module-symfony": "^3.1.1",
"phpstan/phpstan": "^1.10.5",
"phpstan/phpstan": "1.10.5",
"phpstan/phpstan-symfony": "^1.2.20",
"phpunit/phpunit": "10.2.7",
"nyholm/psr7": "^1",
Expand Down
11 changes: 8 additions & 3 deletions config/api_platform/resources/asset.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
resources:
Pimcore\Bundle\StudioApiBundle\Dto\Asset:
#security: 'is_granted("API_PLATFORM")'
operations:
ApiPlatform\Metadata\GetCollection:
filters: [ Pimcore\Bundle\StudioApiBundle\Filter\AssetParentIdFilter ]
filters:
- Pimcore\Bundle\StudioApiBundle\Filter\AssetParentIdFilter
- Pimcore\Bundle\StudioApiBundle\Filter\AssetIdSearchFilter
- Pimcore\Bundle\StudioApiBundle\Filter\AssetExcludeFolderFilter
- Pimcore\Bundle\StudioApiBundle\Filter\AssetPathFilter
paginationClientItemsPerPage: true
ApiPlatform\Metadata\Get:
normalizationContext:
groups: [ 'asset:read', 'asset:item:get', 'dependency:read', 'property:read']
groups: [ 'asset:read', 'asset:item:get', 'dependency:read', 'property:read', 'element:read', 'element:item:get']
ApiPlatform\Metadata\Put:
ApiPlatform\Metadata\Post:
ApiPlatform\Metadata\Delete:
ApiPlatform\Metadata\Patch:
provider: Pimcore\Bundle\StudioApiBundle\State\AssetProvider
normalizationContext:
groups: ['asset:read', 'dependency:read', 'property:read']
groups: ['asset:read', 'dependency:read', 'property:read', 'element:read']
denormalizationContext:
groups: ['asset:write']
properties:
Expand Down
14 changes: 14 additions & 0 deletions config/api_platform/resources/asset/document.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
resources:
Pimcore\Bundle\StudioApiBundle\Dto\Asset\Document:
provider: Pimcore\Bundle\StudioApiBundle\State\AssetProvider
operations:
ApiPlatform\Metadata\Get:
normalizationContext:
groups: ['document:read', 'asset:read', 'asset:item:get', 'dependency:read', 'property:read', 'element:read', 'element:item:get' ]
properties:
id:
identifier: true
normalizationContext:
groups: ['document:read', 'asset:read', 'dependency:read', 'property:read', 'element:read']
denormalizationContext:
groups: ['document:write', 'asset:write']
8 changes: 6 additions & 2 deletions config/api_platform/resources/asset/image.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
resources:
Pimcore\Bundle\StudioApiBundle\Dto\Asset\Image:
provider: Pimcore\Bundle\StudioApiBundle\State\AssetProvider
operations:
ApiPlatform\Metadata\Get:
normalizationContext:
groups: ['image:read', 'asset:read', 'asset:item:get', 'dependency:read', 'property:read', 'element:read', 'element:item:get' ]
properties:
id:
identifier: true
normalizationContext:
groups: ['image:read', 'asset:read', 'task:read', 'dependency:read', 'property:read', 'version:read']
groups: ['image:read', 'asset:read', 'dependency:read', 'property:read', 'element:read']
denormalizationContext:
groups: ['image:write', 'asset:write']
groups: ['image:write', 'asset:write']
14 changes: 14 additions & 0 deletions config/api_platform/resources/asset/video.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
resources:
Pimcore\Bundle\StudioApiBundle\Dto\Asset\Video:
provider: Pimcore\Bundle\StudioApiBundle\State\AssetProvider
operations:
ApiPlatform\Metadata\Get:
normalizationContext:
groups: ['video:read', 'asset:read', 'asset:item:get', 'dependency:read', 'property:read', 'element:read', 'element:item:get' ]
properties:
id:
identifier: true
normalizationContext:
groups: ['video:read', 'asset:read', 'dependency:read', 'property:read', 'element:read']
denormalizationContext:
groups: ['video:write', 'asset:write']
13 changes: 13 additions & 0 deletions config/api_platform/resources/token/create.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
resources:
Pimcore\Bundle\StudioApiBundle\Dto\Token\Create:
shortName: Token-Create
operations:
ApiPlatform\Metadata\Post:
processor: Pimcore\Bundle\StudioApiBundle\State\Token\Create\Processor
output: Pimcore\Bundle\StudioApiBundle\Dto\Token\Output
uriTemplate: '/token/create'
openapiContext:
summary: 'Creates and returns a token'

normalizationContext:
groups: [ 'token:read' ]
13 changes: 13 additions & 0 deletions config/api_platform/resources/token/refresh.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
resources:
Pimcore\Bundle\StudioApiBundle\Dto\Token\Refresh:
shortName: Token-Refresh
operations:
ApiPlatform\Metadata\Post:
processor: Pimcore\Bundle\StudioApiBundle\State\Token\Refresh\Processor
output: Pimcore\Bundle\StudioApiBundle\Dto\Token\Output
uriTemplate: '/token/refresh'
openapiContext:
summary: 'Refreshes an existing token'

normalizationContext:
groups: [ 'tokenrefresh:read' ]
12 changes: 12 additions & 0 deletions config/api_platform/resources/translation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
resources:
Pimcore\Bundle\StudioApiBundle\Dto\Translation:
#security: 'is_granted("PUBLIC_API_PLATFORM", "translation")'
operations:
ApiPlatform\Metadata\Post:
processor: Pimcore\Bundle\StudioApiBundle\State\TranslationProcessor
uriTemplate: '/translations'
openapiContext:
summary: 'Getting translations based on context'

normalizationContext:
groups: [ 'translation:read' ]
5 changes: 4 additions & 1 deletion config/api_platform/resources/user.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ resources:
input: Pimcore\Bundle\StudioApiBundle\Dto\ResetPasswordRequest
output: false
uriTemplate: '/users/reset-password'

ApiPlatform\Metadata\Get:
normalizationContext:
groups: [ 'user:read' ]
provider: Pimcore\Bundle\StudioApiBundle\State\UserProvider
normalizationContext:
groups: [ 'get' ]
denormalizationContext:
Expand Down
20 changes: 20 additions & 0 deletions config/pimcore/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
api_platform:
title: 'Pimcore Studio API'
description: 'API for Pimcore Studio UI'
version: 0.0.1
graphql:
graphql_playground: false
graphiql:
enabled: false
event_listeners_backward_compatibility_layer: false
keep_legacy_inflector: false
enable_docs: true
enable_entrypoint: false
enable_swagger_ui: false
enable_re_doc: false
show_webby: false
swagger:
api_keys:
access_token:
name: 'Authorization'
type: 'header'
6 changes: 3 additions & 3 deletions config/pimcore/routing.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
api_platform:
resource: .
type: api_platform
prefix: /api
resource: .
type: api_platform
prefix: /api
36 changes: 4 additions & 32 deletions config/serialization/asset.yaml
Original file line number Diff line number Diff line change
@@ -1,48 +1,20 @@
Pimcore\Bundle\StudioApiBundle\Dto\Asset:
attributes:
id:
groups: ['asset:read']
parentId:
groups: ['asset:read']
permissions:
groups: [ 'asset:read' ]
type:
groups: ['asset:read']
iconName:
groups: [ 'asset:read' ]
children:
groups: ['asset:read']
filename:
groups: ['asset:read']
path:
groups: ['asset:read']
mimetype:
groups: ['asset:read']
creationDate:
groups: ['asset:read']
modificationDate:
groups: ['asset:read']
userOwner:
groups: ['asset:read']
userModification:
groups: ['asset:read']
properties:
groups: ['asset:item:get']
versions:
groups: ['asset:read']
metadata:
groups: ['asset:read']
locked:
groups: ['asset:read']
lock:
groups: ['asset:read']
customSettings:
groups: ['asset:item:get']
hasMetaData:
groups: ['asset:read']
dependencies:
groups: ['asset:item:get']
scheduledTasks:
groups: ['asset:item:get']
versionCount:
groups: ['asset:item:get']
fullPath:
groups: ['asset:read']
userPermissions:
groups: ['asset:read']
6 changes: 6 additions & 0 deletions config/serialization/asset/document.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Pimcore\Bundle\StudioApiBundle\Dto\Asset\Document:
attributes:
pageCount:
groups: ['document:read', 'asset:read']
imageThumbnailPath:
groups: ['document:read', 'asset:read']
Loading

0 comments on commit 337b5da

Please sign in to comment.