Skip to content

Commit 4c50f5a

Browse files
committed
Merge 4.0
2 parents b968ccd + 209b633 commit 4c50f5a

File tree

6 files changed

+56
-4
lines changed

6 files changed

+56
-4
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ On write operations, we added the [expectsHeader](https://www.hydra-cg.com/spec/
3939
* [d0a442786](https://github.com/api-platform/core/commit/d0a44278630d201b91cbba0774a09f4eeaac88f7) feat(doctrine): enhance getLinksHandler with method validation and typo suggestions (#6874)
4040
* [f67f6f1ac](https://github.com/api-platform/core/commit/f67f6f1acb6476182c18a3503f2a8bc80ae89a0b) feat(doctrine): doctrine filters like laravel eloquent filters (#6775)
4141

42+
## v4.0.16
43+
44+
### Bug fixes
45+
46+
* [dc4fc84ba](https://github.com/api-platform/core/commit/dc4fc84ba93e22b4f44a37e90a93c6d079c1c620) fix(graphql): securityAfterResolver not called
47+
48+
### Features
49+
4250
## v4.0.15
4351

4452
### Bug fixes
@@ -291,6 +299,13 @@ Notes:
291299

292300
* [0d5f35683](https://github.com/api-platform/core/commit/0d5f356839eb6aa9f536044abe4affa736553e76) feat(laravel): laravel component (#5882)
293301

302+
## v3.4.16
303+
304+
### Bug fixes
305+
306+
* [dc4fc84ba](https://github.com/api-platform/core/commit/dc4fc84ba93e22b4f44a37e90a93c6d079c1c620) fix(graphql): securityAfterResolver not called
307+
* [9eb5c4e94](https://github.com/api-platform/core/commit/9eb5c4e941d0ebf59bc8ef5777b144db9b4a0899) fix(symfony): suggest `DocumentationAction` as replacement for deprecated `SwaggerUiAction` (#6894)
308+
294309
## v3.4.15
295310

296311
### Bug fixes
@@ -556,6 +571,13 @@ You should now install `api-platform/symfony` instead of `api-platform/core`.
556571
* [74986cb55](https://github.com/api-platform/core/commit/74986cb552182dc645bd1fc967faa0954dd59e0a) feat: inflector as service (#6447)
557572
* [b47edb2a4](https://github.com/api-platform/core/commit/b47edb2a499c34e79c167f963e3a626a3e9d040a) feat(serializer): context IRI in HAL or JsonApi format (#6215)
558573

574+
## v3.3.15
575+
576+
### Bug fixes
577+
578+
* [dc4fc84ba](https://github.com/api-platform/core/commit/dc4fc84ba93e22b4f44a37e90a93c6d079c1c620) fix(graphql): securityAfterResolver not called
579+
* [9eb5c4e94](https://github.com/api-platform/core/commit/9eb5c4e941d0ebf59bc8ef5777b144db9b4a0899) fix(symfony): suggest `DocumentationAction` as replacement for deprecated `SwaggerUiAction` (#6894)
580+
559581
## v3.3.14
560582

561583
### Bug fixes

docs/src/Kernel.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,15 @@ public function executeMigrations(string $direction = Direction::UP): void
164164
$em = $this->getContainer()->get('doctrine.orm.entity_manager');
165165
$loader = new ExistingEntityManager($em);
166166
$dependencyFactory = DependencyFactory::fromEntityManager($confLoader, $loader);
167+
$metadataStorage = $dependencyFactory->getMetadataStorage();
167168

168-
$dependencyFactory->getMetadataStorage()->ensureInitialized();
169-
$executed = $dependencyFactory->getMetadataStorage()->getExecutedMigrations();
169+
try {
170+
$metadataStorage->ensureInitialized();
171+
} catch (\Exception) {
172+
// table exists
173+
}
174+
175+
$executed = $metadataStorage->getExecutedMigrations();
170176

171177
if ($executed->hasMigration(new Version($migrationClass)) && Direction::DOWN !== $direction) {
172178
continue;

features/graphql/query.feature

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,3 +677,20 @@ Feature: GraphQL query support
677677
Then the response status code should be 200
678678
And the header "Content-Type" should be equal to "application/json"
679679
And the JSON node "data.getSecurityAfterResolver.name" should be equal to "test"
680+
681+
682+
Scenario: Call security after resolver with 403 error (ensure /2 does not match securityAfterResolver)
683+
When I send the following GraphQL request:
684+
""""
685+
{
686+
getSecurityAfterResolver(id: "/security_after_resolvers/2") {
687+
name
688+
}
689+
}
690+
"""
691+
Then the response status code should be 200
692+
And the response should be in JSON
693+
And the header "Content-Type" should be equal to "application/json"
694+
And the JSON node "errors[0].extensions.status" should be equal to 403
695+
And the JSON node "errors[0].message" should be equal to "Access Denied."
696+
And the JSON node "data.getSecurityAfterResolver.name" should not exist

src/Symfony/Bundle/SwaggerUi/SwaggerUiAction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
/**
2727
* Displays the swaggerui interface.
2828
*
29-
* @deprecated use ApiPlatform\Symfony\Bundle\SwaggerUi\Processor instead
29+
* @deprecated use ApiPlatform\Symfony\Action\DocumentationAction instead
3030
*
3131
* @author Antoine Bluchet <[email protected]>
3232
*/

src/Symfony/Security/State/AccessCheckerProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function provide(Operation $operation, array $uriVariables = [], array $c
5353

5454
$isGranted = $operation->getSecurityAfterResolver();
5555
$message = $operation->getSecurityMessageAfterResolver();
56-
// no break
56+
break;
5757
default:
5858
$isGranted = $operation->getSecurity();
5959
$message = $operation->getSecurityMessage();

tests/Fixtures/TestBundle/ApiResource/Issue6427/SecurityAfterResolverResolver.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ final class SecurityAfterResolverResolver implements QueryItemResolverInterface
2323
*/
2424
public function __invoke($item, array $context): SecurityAfterResolver
2525
{
26+
$idUrl = $context['args']['id'];
27+
28+
if (str_contains($idUrl, '2')) {
29+
// Unknown to simulate a 403 error
30+
return new SecurityAfterResolver('2', 'nonexistent');
31+
}
32+
2633
return new SecurityAfterResolver('1', 'test');
2734
}
2835
}

0 commit comments

Comments
 (0)