Skip to content

Commit

Permalink
Add security
Browse files Browse the repository at this point in the history
  • Loading branch information
mattamon committed Apr 4, 2024
1 parent b5632e5 commit 62fef60
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 12 deletions.
15 changes: 4 additions & 11 deletions config/api/V1/translation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
post:
tags: [Translation]
summary: Get all translations
security:
- access_token: []
requestBody:
description: Locale and array of keys
content:
application/hal+json:
application/json:
schema:
ref: '#/components/schemas/Translation'
responses:
Expand All @@ -14,16 +16,7 @@
content:
application/json:
schema:
type: object
properties:
locale:
type: string
example: en
keys:
type: array
items:
type: string
example: 'key1'
ref: '#/components/schemas/Translation'
'403':
description: Unauthorized
content:
Expand Down
4 changes: 4 additions & 0 deletions config/pimcore/packages/nelmio_api_doc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ nelmio_api_doc:
version: 1.0.0

components:
securitySchemes:
access_token:
type: http
scheme: bearer
schemas:
Translation:
type: object
Expand Down
2 changes: 1 addition & 1 deletion src/Dto/Translation.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{
public function __construct(
private string $locale = 'en',
private array $keys = []
private array $keys = [PublicTranslations::PUBLIC_KEYS]

Check failure on line 26 in src/Dto/Translation.php

View workflow job for this annotation

GitHub Actions / Static Analysis with PHPStan (8.2, highest, false)

Access to constant PUBLIC_KEYS on an unknown class Pimcore\Bundle\StudioApiBundle\Dto\PublicTranslations.

Check failure on line 26 in src/Dto/Translation.php

View workflow job for this annotation

GitHub Actions / Static Analysis with PHPStan (8.2, highest, 11.x-dev as 11.99.9, true)

Access to constant PUBLIC_KEYS on an unknown class Pimcore\Bundle\StudioApiBundle\Dto\PublicTranslations.
) {
}

Expand Down

0 comments on commit 62fef60

Please sign in to comment.