• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

api-platform / core / 6067528200

04 Sep 2023 12:12AM UTC coverage: 36.875% (-21.9%) from 58.794%
6067528200

Pull #5791

github

web-flow
Merge 64157e578 into d09cfc9d2
Pull Request #5791: fix: strip down any sql function name

3096 of 3096 new or added lines in 205 files covered. (100.0%)

9926 of 26918 relevant lines covered (36.87%)

6.5 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/GraphQl/Resolver/Stage/SecurityPostDenormalizeStage.php
1
<?php
2

3
/*
4
 * This file is part of the API Platform project.
5
 *
6
 * (c) Kévin Dunglas <dunglas@gmail.com>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11

12
declare(strict_types=1);
13

14
namespace ApiPlatform\GraphQl\Resolver\Stage;
15

16
use ApiPlatform\Metadata\GraphQl\Operation;
17
use ApiPlatform\Symfony\Security\ResourceAccessCheckerInterface;
18
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
19

20
/**
21
 * Security post denormalize stage of GraphQL resolvers.
22
 *
23
 * @author Vincent Chalamon <vincentchalamon@gmail.com>
24
 */
25
final class SecurityPostDenormalizeStage implements SecurityPostDenormalizeStageInterface
26
{
27
    public function __construct(private readonly ?ResourceAccessCheckerInterface $resourceAccessChecker)
28
    {
29
    }
×
30

31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function __invoke(string $resourceClass, Operation $operation, array $context): void
35
    {
36
        $isGranted = $operation->getSecurityPostDenormalize();
×
37

38
        if (null !== $isGranted && null === $this->resourceAccessChecker) {
×
39
            throw new \LogicException('Cannot check security expression when SecurityBundle is not installed. Try running "composer require symfony/security-bundle".');
×
40
        }
41

42
        if (null === $isGranted || $this->resourceAccessChecker->isGranted($resourceClass, (string) $isGranted, $context['extra_variables'])) {
×
43
            return;
×
44
        }
45

46
        throw new AccessDeniedHttpException($operation->getSecurityPostDenormalizeMessage() ?? 'Access Denied.');
×
47
    }
48
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc