diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index efcbd906a..4e0898ee1 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -105,7 +105,7 @@ jobs: url=$release-demo.api-platform.com fi echo "url=$url" >> "$GITHUB_OUTPUT" - cors="https://$url|http://localhost|https://localhost|http://localhost:3000" + cors="https://$url|http://localhost|https://localhost|http://localhost:3000|https://api-platform.github.io" set -o pipefail helm upgrade $release ./helm/api-platform -f ./helm/api-platform/values.yaml \ --install \ diff --git a/api/config/packages/doctrine.yaml b/api/config/packages/doctrine.yaml index 6c57caf31..274b96ef0 100644 --- a/api/config/packages/doctrine.yaml +++ b/api/config/packages/doctrine.yaml @@ -8,6 +8,7 @@ doctrine: profiling_collect_backtrace: '%kernel.debug%' orm: + enable_native_lazy_objects: true validate_xml_mapping: true naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware identity_generation_preferences: diff --git a/api/src/Entity/Book.php b/api/src/Entity/Book.php index c797164c6..0eae8c193 100644 --- a/api/src/Entity/Book.php +++ b/api/src/Entity/Book.php @@ -41,6 +41,7 @@ */ #[ApiResource( uriTemplate: '/admin/books{._format}', + shortName: 'AdminBook', types: [ 'https://schema.org/Book', 'https://schema.org/Offer', diff --git a/api/src/Entity/Review.php b/api/src/Entity/Review.php index 5165f24ef..1e0c49e5a 100644 --- a/api/src/Entity/Review.php +++ b/api/src/Entity/Review.php @@ -38,6 +38,7 @@ * @see https://schema.org/Review */ #[ApiResource( + shortName: 'AdminReview', types: ['https://schema.org/Review'], operations: [ new GetCollection( diff --git a/api/src/Entity/User.php b/api/src/Entity/User.php index 5b9a23664..b2a0cc3f8 100644 --- a/api/src/Entity/User.php +++ b/api/src/Entity/User.php @@ -25,6 +25,7 @@ * @see https://schema.org/Person */ #[ApiResource( + shortName: 'AdminUser', types: ['https://schema.org/Person'], operations: [ new GetCollection( @@ -38,6 +39,15 @@ uriTemplate: '/admin/users/{id}{._format}', security: 'is_granted("OIDC_ADMIN")' ), + ], + normalizationContext: [ + AbstractNormalizer::GROUPS => ['User:read'], + AbstractObjectNormalizer::SKIP_NULL_VALUES => true, + ] +)] +#[ApiResource( + types: ['https://schema.org/Person'], + operations: [ new Get( uriTemplate: '/users/{id}{._format}', security: 'object === user' diff --git a/api/tests/Api/Admin/schemas/Book/collection.json b/api/tests/Api/Admin/schemas/Book/collection.json index eb02f1a8f..fefcebdbb 100644 --- a/api/tests/Api/Admin/schemas/Book/collection.json +++ b/api/tests/Api/Admin/schemas/Book/collection.json @@ -73,7 +73,7 @@ "@context": { "readOnly": true, "type": "string", - "pattern": "^/contexts/Book$" + "pattern": "^/contexts/AdminBook$" }, "@type": { "readOnly": true, diff --git a/api/tests/Api/Admin/schemas/Book/item.json b/api/tests/Api/Admin/schemas/Book/item.json index b150ceb5c..60a108593 100644 --- a/api/tests/Api/Admin/schemas/Book/item.json +++ b/api/tests/Api/Admin/schemas/Book/item.json @@ -6,7 +6,7 @@ "@context": { "readOnly": true, "type": "string", - "pattern": "^/contexts/Book$" + "pattern": "^/contexts/AdminBook$" }, "@type": { "readOnly": true, diff --git a/api/tests/Api/Admin/schemas/Review/collection.json b/api/tests/Api/Admin/schemas/Review/collection.json index 6a1f327d4..66eb3b3f6 100644 --- a/api/tests/Api/Admin/schemas/Review/collection.json +++ b/api/tests/Api/Admin/schemas/Review/collection.json @@ -166,7 +166,7 @@ "@context": { "readOnly": true, "type": "string", - "pattern": "^/contexts/Review$" + "pattern": "^/contexts/AdminReview$" }, "@type": { "readOnly": true, diff --git a/api/tests/Api/Admin/schemas/Review/item.json b/api/tests/Api/Admin/schemas/Review/item.json index 3f81816f5..2bffc6eb8 100644 --- a/api/tests/Api/Admin/schemas/Review/item.json +++ b/api/tests/Api/Admin/schemas/Review/item.json @@ -6,7 +6,7 @@ "@context": { "readOnly": true, "type": "string", - "pattern": "^/contexts/Review$" + "pattern": "^/contexts/AdminReview$" }, "@id": { "readOnly": true, diff --git a/api/tests/Api/Admin/schemas/User/collection.json b/api/tests/Api/Admin/schemas/User/collection.json index f94e49ad0..d7be2646d 100644 --- a/api/tests/Api/Admin/schemas/User/collection.json +++ b/api/tests/Api/Admin/schemas/User/collection.json @@ -52,7 +52,7 @@ "@context": { "readOnly": true, "type": "string", - "pattern": "^/contexts/User$" + "pattern": "^/contexts/AdminUser$" }, "@type": { "readOnly": true, diff --git a/api/tests/Api/Admin/schemas/User/item.json b/api/tests/Api/Admin/schemas/User/item.json index 945d5b051..3b6ffb5a6 100644 --- a/api/tests/Api/Admin/schemas/User/item.json +++ b/api/tests/Api/Admin/schemas/User/item.json @@ -6,7 +6,7 @@ "@context": { "readOnly": true, "type": "string", - "pattern": "^/contexts/User$" + "pattern": "^/contexts/AdminUser$" }, "@id": { "readOnly": true,