Skip to content

Commit ff67925

Browse files
Maxcastelsoyuka
authored andcommitted
chore: deprecate link_security and set it default to true
1 parent 45831a9 commit ff67925

4 files changed

Lines changed: 9 additions & 5 deletions

File tree

src/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -995,9 +995,7 @@ private function registerArgumentResolverConfiguration(PhpFileLoader $loader): v
995995

996996
private function registerLinkSecurityConfiguration(PhpFileLoader $loader, array $config): void
997997
{
998-
if ($config['enable_link_security']) {
999-
$loader->load('link_security.php');
1000-
}
998+
$loader->load('link_security.php');
1001999
}
10021000

10031001
private function registerJsonStreamerConfiguration(ContainerBuilder $container, PhpFileLoader $loader, array $formats, array $config): void

src/Symfony/Bundle/DependencyInjection/Configuration.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,11 @@ public function getConfigTreeBuilder(): TreeBuilder
117117
->booleanNode('enable_docs')->defaultTrue()->info('Enable the docs')->end()
118118
->booleanNode('enable_profiler')->defaultTrue()->info('Enable the data collector and the WebProfilerBundle integration.')->end()
119119
->booleanNode('enable_phpdoc_parser')->defaultTrue()->info('Enable resource metadata collector using PHPStan PhpDocParser.')->end()
120-
->booleanNode('enable_link_security')->defaultFalse()->info('Enable security for Links (sub resources)')->end()
120+
->booleanNode('enable_link_security')
121+
->defaultTrue()
122+
->info('Enable security for Links (sub resources).')
123+
->setDeprecated('api-platform/symfony', '4.2', 'This option is always enabled and will be removed in API Platform 5.0.')
124+
->end()
121125
->arrayNode('collection')
122126
->addDefaultsIfNotSet()
123127
->children()

tests/Fixtures/app/config/config_common.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ api_platform:
8282
http_cache:
8383
invalidation:
8484
enabled: true
85+
# TODO: remove in 5.0
8586
enable_link_security: true
8687
# see also defaults in AppKernel
8788
doctrine_mongodb_odm: false

tests/Symfony/Bundle/DependencyInjection/ConfigurationTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,8 @@ private function runDefaultConfigTests(array $doctrineIntegrationsToLoad = ['orm
233233
],
234234
'use_symfony_listeners' => false,
235235
'handle_symfony_errors' => false,
236-
'enable_link_security' => false,
236+
// TODO: remove in 5.0
237+
'enable_link_security' => true,
237238
'serializer' => [
238239
'hydra_prefix' => null,
239240
],

0 commit comments

Comments
 (0)