8000 Do not prepend security config · symfony/acl-bundle@feccd34 · GitHub
[go: up one dir, main page]

Skip to content

Commit feccd34

Browse 8000 files
committed
Do not prepend security config
1 parent 094c4b7 commit feccd34

File tree

9 files changed

+19
-107
lines changed

9 files changed

+19
-107
lines changed

DependencyInjection/AclExtension.php

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
namespace Symfony\Bundle\AclBundle\DependencyInjection;
1313

1414
use Symfony\Component\Console\Application;
15-
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
1615
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
1716
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
1817
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -24,7 +23,7 @@
2423
* @author Fabien Potencier <fabien@symfony.com>
2524
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
2625
*/
27-
class AclExtension extends Extension implements PrependExtensionInterface
26+
class AclExtension extends Extension
2827
{
2928
/**
3029
* {@inheritdoc}
@@ -78,44 +77,11 @@ public function load(array $configs, ContainerBuilder $container)
7877
$container->setParameter('security.acl.dbal.sid_table_name', $config['tables']['security_identity']);
7978
}
8079

81-
/**
82-
* {@inheritdoc}
83-
*/
84-
public function getXsdValidationBasePath()
85-
{
86-
return __DIR__.'/../Resources/config/schema';
87-
}
88-
8980
/**
9081
* {@inheritdoc}
9182
*/
9283
public function getNamespace()
9384
{
9485
return 'http://symfony.com/schema/dic/acl';
9586
}
96-
97-
/**
98-
* {@inheritdoc}
99-
*/
100-
public function prepend(ContainerBuilder $container)
101-
{
102-
$securityConfig = $container->getExtensionConfig('security');
103-
$aclConfig = $container->getExtensionConfig('acl');
104-
105-
$reducer = function ($carry, $config) {
106-
return $carry || !empty($config);
107-
};
108-
109-
$hasSecurityConfig = array_reduce($securityConfig, $reducer, false);
110-
$hasAclConfig = array_reduce($aclConfig, $reducer, false);
111-
112-
if ($hasAclConfig && $hasSecurityConfig) {
113-
throw new \RuntimeException('Both the SecurityBundle and the AclBundle are trying to configure the ACL, configure the AclBundle under "acl" only.');
114-
}
115-
116-
if (!$hasAclConfig && $hasSecurityConfig) {
117-
@trigger_error('As of 3.4 the "security.acl" config is deprecated and will be removed in 4.0. Install symfony/acl-bundle configure it under "acl" instead.', E_USER_DEPRECATED);
118-
$container->prependExtensionConfig('acl', $securityConfig['acl']);
119-
}
120-
}
12187
}

Resources/config/console.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
<defaults public="false" />
99

1010
<service id="Symfony\Bundle\AclBundle\Command\InitAclCommand">
11+
<argument type="service" id="security.acl.dbal.connection" />
12+
<argument type="service" id="security.acl.dbal.schema" />
1113
<tag name="console.command" command="acl:init" />
12-
<tag name="console.command" command="init:acl" /> <!-- BC to be removed in 4.0 -->
1314
</service>
1415

1516
<service id="Symfony\Bundle\AclBundle\Command\SetAclCommand">
17+
<argument type="service" id="security.acl.provider" />
1618
<tag name="console.command" command="acl:set" />
1719
</service>
1820
</services>

Tests/DependencyInjection/CompleteConfigurationTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ protected function getContainer($file)
4343
return self::$containerCache[$file];
4444
}
4545
9E81 $container = new ContainerBuilder();
46-
$security = new AclExtension();
47-
$container->registerExtension($security);
46+
$acl = new AclExtension();
47+
$container->registerExtension($acl);
4848

4949
$bundle = new AclBundle();
5050
$bundle->build($container);

Tests/Functional/BundleDeprecationsTest.php

Lines changed: 0 additions & 38 deletions
This file was deleted.

Tests/Functional/SetAclCommandTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111

1212
namespace Symfony\Bundle\AclBundle\Tests\Functional;
1313

14-
use Symfony\Bundle\AclBundle\Command\InitAclCommand;
1514
use Symfony\Bundle\AclBundle\Command\SetAclCommand;
16-
use Symfony\Component\Console\Application;
15+
use Symfony\Bundle\FrameworkBundle\Console\Application;
1716
use Symfony\Component\Console\Tester\CommandTester;
1817
use Symfony\Component\Security\Acl\Domain\ObjectIdentity;
1918
use Symfony\Component\Security\Acl\Domain\RoleSecurityIdentity;
@@ -114,8 +113,7 @@ private function getApplication()
114113
$kernel = static::createKernel(array('test_case' => 'Acl'));
115114
$kernel->boot();
116115

117-
$application = new Application();
118-
$application->add(new InitAclCommand($kernel->getContainer()->get('security.acl.dbal.connection'), $kernel->getContainer()->get('security.acl.dbal.schema')));
116+
$application = new Application($kernel);
119117

120118
$initAclCommand = $application->find('acl:init');
121119
$initAclCommandTester = new CommandTester($initAclCommand);

Tests/Functional/app/Acl/bundles.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@
1212
return array(
1313
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
1414
new Symfony\Bundle\AclBundle\AclBundle(),
15+
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
1516
new Symfony\Bundle\AclBundle\Tests\Functional\Bundle\TestBundle\TestBundle(),
1617
);

Tests/Functional/app/AppKernel.php

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,6 @@
1111

1212
namespace Symfony\Bundle\AclBundle\Tests\Functional\app;
1313

14-
// get the autoload file
15-
$dir = __DIR__;
16-
$lastDir = null;
17-
while ($dir !== $lastDir) {
18-
$lastDir = $dir;
19-
20-
if (is_file($dir.'/autoload.php')) {
21-
require_once $dir.'/autoload.php';
22-
break;
23-
}
24-
25-
if (is_file($dir.'/autoload.php.dist')) {
26-
require_once $dir.'/autoload.php.dist';
27-
break;
28-
}
29-
30-
if (file_exists($dir.'/vendor/autoload.php')) {
31-
require_once $dir.'/vendor/autoload.php';
32-
break;
33-
}
34-
35-
$dir = dirname($dir);
36-
}
37-
3814
use Symfony\Component\Config\Loader\LoaderInterface;
3915
use Symfony\Component\Filesystem\Filesystem;
4016
use Symfony\Component\HttpKernel\Kernel;

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"require-dev": {
2727
"symfony/asset": "~3.4|~4.0",
2828
"symfony/console": "~3.4|~4.0",
29+
"symfony/framework-bundle": "~3.4|~4.0",
2930
"doctrine/doctrine-bundle": "~1.4",
3031
"symfony/phpunit-bridge": "~3.4|~4.0",
3132
"symfony/security-bundle": "~3.4|~4.0",

phpunit.xml.dist

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

33
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.1/phpunit.xsd"
4+
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/6.0/phpunit.xsd"
55
backupGlobals="false"
66
colors="true"
77
bootstrap="vendor/autoload.php"
8+
failOnRisky="true"
9+
failOnWarning="true"
810
>
11+
<php>
12+
<ini name="error_reporting" value="-1" />
13+
</php>
14+
915
<testsuites>
10-
<testsuite>
16+
<testsuite name="Symfony AclBundle Test Suite">
1117
<directory>./Tests/</directory>
1218
</testsuite>
1319
</testsuites>
@@ -16,9 +22,9 @@
1622
<whitelist>
1723
<directory>./</directory>
1824
<exclude>
19-
<directory>./vendor</directory>
2025
<directory>./Resources</directory>
2126
<directory>./Tests</directory>
27+
<directory>./vendor</directory>
2228
</exclude>
2329
</whitelist>
2430
</filter>

0 commit comments

Comments
 (0)
0