Skip to content

Commit

Permalink
minor #2223 remove the deprecated access denied listener (xabbuh)
Browse files Browse the repository at this point in the history
This PR was merged into the 3.0-dev branch.

Discussion
----------

remove the deprecated access denied listener

Commits
-------

073bde5 remove the deprecated access denied listener
  • Loading branch information
xabbuh committed May 23, 2020
2 parents 9f3444c + 073bde5 commit 7ae3293
Show file tree
Hide file tree
Showing 15 changed files with 7 additions and 539 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ CHANGELOG
* dropped support for Symfony components < 4.4
* removed the following options:

* `fos_rest.access_denied_listener`
* `fos_rest.exception.exception_controller`
* `fos_rest.exception.exception_listener`
* `fos_rest.exception.service`
Expand All @@ -51,6 +52,7 @@ CHANGELOG
* `FOS\RestBundle\Controller\ExceptionController`
* `FOS\RestBundle\Controller\TemplatingExceptionController`
* `FOS\RestBundle\Controller\TwigExceptionController`
* `FOS\RestBundle\EventListener\AccessDeniedListener`
* `FOS\RestBundle\EventListener\ExceptionListener`
* `FOS\RestBundle\Inflector\DoctrineInflector`
* `FOS\RestBundle\Inflector\InflectorInterface`
Expand All @@ -68,6 +70,7 @@ CHANGELOG

* removed the following services and aliases:

* `fos_rest.access_denied_listener`
* `fos_rest.exception_listener`
* `fos_rest.exception.controller`
* `fos_rest.exception.twig_controller`
Expand Down
22 changes: 0 additions & 22 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,6 @@ public function getConfigTreeBuilder(): TreeBuilder
$rootNode
->children()
->scalarNode('disable_csrf_role')->defaultNull()->end()
->arrayNode('access_denied_listener')
->canBeEnabled()
->setDeprecated('The "%path%.%node%" option is deprecated since FOSRestBundle 2.8.')
->beforeNormalization()
->ifArray()->then(function ($v) {
if (!empty($v) && empty($v['formats'])) {
unset($v['enabled']);
$v = ['enabled' => true, 'formats' => $v];
}

return $v;
})
->end()
->fixXmlConfig('format', 'formats')
->children()
->scalarNode('service')->defaultNull()->end()
->arrayNode('formats')
->useAttributeAsKey('name')
->prototype('boolean')->end()
->end()
->end()
->end()
->scalarNode('unauthorized_challenge')->defaultNull()->end()
->arrayNode('param_fetcher_listener')
->beforeNormalization()
Expand Down
17 changes: 0 additions & 17 deletions DependencyInjection/FOSRestExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ public function load(array $configs, ContainerBuilder $container): void
$this->loadVersioning($config, $loader, $container);
$this->loadParamFetcherListener($config, $loader, $container);
$this->loadAllowedMethodsListener($config, $loader, $container);
$this->loadAccessDeniedListener($config, $loader, $container);
$this->loadZoneMatcherListener($config, $loader, $container);

// Needs RequestBodyParamConverter and View Handler loaded.
Expand All @@ -93,22 +92,6 @@ private function loadForm(array $config, XmlFileLoader $loader, ContainerBuilder
}
}

private function loadAccessDeniedListener(array $config, XmlFileLoader $loader, ContainerBuilder $container): void
{
if ($config['access_denied_listener']['enabled'] && !empty($config['access_denied_listener']['formats'])) {
$loader->load('access_denied_listener.xml');

$service = $container->getDefinition('fos_rest.access_denied_listener');

if (!empty($config['access_denied_listener']['service'])) {
$service->clearTag('kernel.event_subscriber');
}

$service->replaceArgument(0, $config['access_denied_listener']['formats']);
$service->replaceArgument(1, $config['unauthorized_challenge']);
}
}

private function loadAllowedMethodsListener(array $config, XmlFileLoader $loader, ContainerBuilder $container): void
{
if ($config['allowed_methods_listener']['enabled']) {
Expand Down
92 changes: 0 additions & 92 deletions EventListener/AccessDeniedListener.php

This file was deleted.

18 changes: 0 additions & 18 deletions Resources/config/access_denied_listener.xml

This file was deleted.

Loading

0 comments on commit 7ae3293

Please sign in to comment.