8000 Changed minimum sf version to 3.3 · symfony/acl-bundle@4ef69f4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4ef69f4

Browse files
author
Iltar van der Berg
committed
Changed minimum sf version to 3.3
1 parent 45a1546 commit 4ef69f4

File tree

9 files changed

+89
-52
lines changed

9 files changed

+89
-52
lines changed

.travis.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,30 @@ language: php
22

33
sudo: false
44

5+
cache:
6+
directories:
7+
- "$HOME/.composer/cache/files"
8+
59
env:
610
- COMPOSER_FLAGS="--prefer-stable"
711

12+
php:
13+
- 5.6
14+
- 7.1
15+
816
matrix:
917
include:
10-
- php: 5.5
11-
env: COMPOSER_FLAGS="--prefer-lowest"
1218
- php: 5.6
13-
- php: hhvm
19+
env: COMPOSER_FLAGS="--prefer-lowest"
1420
- php: 7.0
15-
env: COMPOSER_FLAGS="" SYMFONY_VERSION="3.0.*"
21+
env: COMPOSER_FLAGS=""
22+
- php: 7.1
23+
env: COMPOSER_FLAGS="" SYMFONY_VERSION="3.4.x-dev"
24+
- php: 7.1
25+
env: COMPOSER_FLAGS="" SYMFONY_VERSION="dev-master"
1626

1727
before_install: if [[ "$SYMFONY_VERSION" != "" ]]; then composer require --no-update symfony/symfony:${SYMFONY_VERSION}; fi
1828

19-
install: composer update $COMPOSER_FLAGS
29+
install: composer update $COMPOSER_FLAGS --prefer-dist
30+
31+
script: vendor/bin/simple-phpunit

Command/InitAclCommand.php

Lines changed: 12 additions & 1 deletion
Original file 8000 line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
* Installs the tables required by the ACL system.
2121
*
2222
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
23+
*
24+
* @final since version 3.4
2325
*/
2426
class InitAclCommand extends ContainerAwareCommand
2527
{
@@ -41,7 +43,8 @@ public function isEnabled()
4143
protected function configure()
4244
{
4345
$this
44-
->setName('init:acl')
46+
->setName('acl:init')
47+
->setAliases(array('init:acl'))
4548
->setDescription('Mounts ACL tables in the database')
4649
->setHelp(<<<'EOF'
4750
The <info>%command.name%</info> command mounts ACL tables in the database.
@@ -63,6 +66,14 @@ protected function configure()
6366
*/
6467
protected function execute(InputInterface $input, OutputInterface $output)
6568
{
69+
if (false !== strpos($input->getFirstArgument(), ':a')) {
70+
$warning = 'The use of "init:acl" command is deprecated since version 3.4 and will be removed in 4.0. Use the "acl:init" command instead.';
71+
72+
@trigger_error($warning, E_USER_DEPRECATED);
73+
74+
$output->writeln('<comment>'.$warning.'</>');
75+
}
76+
6677
$container = $this->getContainer();
6778

6879
$connection = $container->get('security.acl.dbal.connection');

Command/SetAclCommand.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\AclBundle\Command;
1313

14+
1415
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
1516
use Symfony\Component\Console\Input\InputArgument;
1617
use Symfony\Component\Console\Input\InputInterface;
@@ -27,6 +28,8 @@
2728
* Sets ACL for objects.
2829
*
2930
* @author Kévin Dunglas <kevin@les-tilleuls.coop>
31+
*
32+
* @final since version 3.4
3033
*/
3134
class SetAclCommand extends ContainerAwareCommand
3235
{
@@ -57,7 +60,7 @@ protected function configure()
5760
->setDescription('Sets ACL for objects')
5861
->setHelp(<<<EOF
5962
The <info>%command.name%</info> command sets ACL.
60-
The ACL system must have been initialized with the <info>init:acl</info> command.
63+
The ACL system must have been initialized with the <info>acl:init</info> command.
6164
6265
To set <comment>VIEW</comment> and <comment>EDIT</comment> permissions for the user <comment>kevin</comment> on the instance of
6366
<comment>Acme\MyClass</comment> having the identifier <comment>42</comment>:

DependencyInjection/AclExtension.php

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

1212
namespace Symfony\Bundle\AclBundle\DependencyInjection;
1313

14+
use Symfony\Component\Console\Application;
1415
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
1516
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
1617
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
@@ -36,6 +37,10 @@ public function load(array $configs, ContainerBuilder $container)
3637
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
3738
$loader->load('security_acl.xml');
3839

40+
if (class_exists(Application::class)) {
41+
$loader->load('console.xml');
42+
}
43+
3944
if (isset($config['cache']['id'])) {
4045
$container->setAlias('security.acl.cache', $config['cache']['id']);
4146
}

Resources/config/console.xml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" ?>
2+
3+
<container xmlns="http://symfony.com/schema/dic/services"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
6+
7+
<services>
8+
<defaults public="false" />
9+
10+
<service id="Symfony\Bundle\AclBundle\Command\InitAclCommand">
11+
<tag name="console.command" command="acl:init" />
12+
<tag name="console.command" command="init:acl" /> <!-- BC to be removed in 4.0 -->
13+
</service>
14+
15+
<service id="Symfony\Bundle\AclBundle\Command\SetAclCommand">
16+
<tag name="console.command" command="acl:set" />
17+
</service>
18+
</services>
19+
</container>

Resources/config/security_acl.xml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,24 @@
55
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
66

77
<services>
8-
<service id="security.acl.object_identity_retrieval_strategy" class="Symfony\Component\Security\Acl\Domain\ObjectIdentityRetrievalStrategy" public="false" />
8+
<defaults public="false" />
99

10-
<service id="security.acl.security_identity_retrieval_strategy" class="Symfony\Component\Security\Acl\Domain\SecurityIdentityRetrievalStrategy" public="false">
10+
<service id="security.acl.object_identity_retrieval_strategy" class="Symfony\Component\Security\Acl\Domain\ObjectIdentityRetrievalStrategy" />
11+
12+
<service id="security.acl.security_identity_retrieval_strategy" class="Symfony\Component\Security\Acl\Domain\SecurityIdentityRetrievalStrategy">
1113
<argument type="service" id="security.role_hierarchy" />
1214
<argument type="service" id="security.authentication.trust_resolver" />
1315
</service>
1416

15-
<service id="security.acl.permission_granting_strategy" class="Symfony\Component\Security\Acl\Domain\PermissionGrantingStrategy" public="false">
17+
<service id="security.acl.permission_granting_strategy" class="Symfony\Component\Security\Acl\Domain\PermissionGrantingStrategy">
1618
<call method="setAuditLogger">
1719
<argument type="service" id="security.acl.audit_logger" on-invalid="ignore" />
1820
</call>
1921
</service>
2022

21-
<service id="security.acl.permission.map" class="Symfony\Component\Security\Acl\Permission\BasicPermissionMap" public="false" />
23+
<service id="security.acl.permission.map" class="Symfony\Component\Security\Acl\Permission\BasicPermissionMap" />
2224

23-
<service id="security.acl.voter.basic_permissions" class="Symfony\Component\Security\Acl\Voter\AclVoter" public="false">
25+
<service id="security.acl.voter.basic_permissions" class="Symfony\Component\Security\Acl\Voter\AclVoter">
2426
<tag name="monolog.logger" channel="security" />
2527
<argument type="service" id="security.acl.provider" />
2628
<argument type="service" id="security.acl.object_identity_retrieval_strategy" />

Resources/config/security_acl_dbal.xml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
66

77
<services>
8-
<service id="security.acl.dbal.connection" alias="database_connection" />
8+
<defaults public="false" />
99

10-
<service id="security.acl.dbal.provider" class="Symfony\Component\Security\Acl\Dbal\MutableAclProvider" public="false">
10+
<service id="security.acl.dbal.connection" alias="database_connection" public="true" />
11+
12+
<service id="security.acl.dbal.provider" class="Symfony\Component\Security\Acl\Dbal\MutableAclProvider">
1113
<argument type="service" id="security.acl.dbal.connection" />
1214
<argument type="service" id="security.acl.permission_granting_strategy" />
1315
<argument type="collection">
@@ -20,7 +22,7 @@
2022
<argument type="service" id="security.acl.cache" on-invalid="null" />
2123
</service>
2224

23-
<service id="security.acl.dbal.schema" class="Symfony\Component\Security\Acl\Dbal\Schema">
25+
<service id="security.acl.dbal.schema" class="Symfony\Component\Security\Acl\Dbal\Schema" public="true">
2426
<argument type="collection">
2527
<argument key="class_table_name">%security.acl.dbal.class_table_name%</argument>
2628
<argument key="entry_table_name">%security.acl.dbal.entry_table_name%</argument>
@@ -30,17 +32,18 @@
3032
</argument>
3133
<argument type="service" id="security.acl.dbal.connection" />
3234
</service>
33-
<service id="security.acl.dbal.schema_listener" class="Symfony\Bundle\AclBundle\EventListener\AclSchemaListener" public="false">
35+
<service id="security.acl.dbal.schema_listener" class="Symfony\Bundle\SecurityBundle\EventListener\AclSchemaListener">
3436
<argument type="service" id="security.acl.dbal.schema" />
3537
</service>
3638

37-
<service id="security.acl.provider" alias="security.acl.dbal.provider" />
39+
<service id="security.acl.provider" alias="security.acl.dbal.provider" public="true" />
40+
<service id="Symfony\Component\Security\Acl\Model\AclProviderInterface" alias="security.acl.provider" />
3841

39-
<service id="security.acl.cache.doctrine" class="Symfony\Component\Security\Acl\Domain\DoctrineAclCache" public="false">
42+
<service id="security.acl.cache.doctrine" class="Symfony\Component\Security\Acl\Domain\DoctrineAclCache">
4043
<argument type="service" id="security.acl.cache.doctrine.cache_impl" />
4144
<argument type="service" id="security.acl.permission_granting_strategy" />
4245
</service>
4346

44-
<service id="security.acl.cache.doctrine.cache_impl" alias="doctrine.orm.default_result_cache" public="false" />
47+
<service id="security.acl.cache.doctrine.cache_impl" alias="doctrine.orm.default_result_cache" />
4548
</services>
4649
</container>

Tests/Functional/SetAclCommandTest.php

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,6 @@
1111

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

14-
/*
15-
* This file is part of the Symfony package.
16-
*
17-
* (c) Fabien Potencier <fabien@symfony.com>
18-
*
19-
* For the full copyright and license information, please view the LICENSE
20-
* file that was distributed with this source code.
21-
*/
2214
use Symfony\Bundle\FrameworkBundle\Console\Application;
2315
use Symfony\Bundle\AclBundle\Command\InitAclCommand;
2416
use Symfony\Bundle\AclBundle\Command\SetAclCommand;
@@ -37,23 +29,12 @@
3729
*/
3830
class SetAclCommandTest extends WebTestCase
3931
{
40-
const OBJECT_CLASS = 'Symfony\Bundle\AclBundle\Tests\Functional\Bundle\AclBundle\Entity\Car';
32+
const OBJECT_CLASS = 'Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\AclBundle\Entity\Car';
4133
const SECURITY_CLASS = 'Symfony\Component\Security\Core\User\User';
4234

43-
protected function setUp()
44-
{
45-
parent::setUp();
46-
47-
$this->deleteTmpDir('Acl');
48-
}
49-
50-
protected function tearDown()
51-
{
52-
parent::tearDown();
53-
54-
$this->deleteTmpDir('Acl');
55-
}
56-
35+
/**
36+
* @group legacy
37+
*/
5738
public function testSetAclUser()
5839
{
5940
$objectId = 1;
@@ -183,9 +164,9 @@ private function getApplication()
183164
$application = new Application($kernel);
184165
$application->add(new InitAclCommand());
185166

186-
$initAclCommand = $application->find('init:acl');
167+
$initAclCommand = $application->find('acl:init');
187168
$initAclCommandTester = new CommandTester($initAclCommand);
188-
$initAclCommandTester->execute(array('command' => 'init:acl'));
169+
$initAclCommandTester->execute(array('command' => 'acl:init'));
189170

190171
return $application;
191172
}

composer.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,18 @@
1717
],
1818
"require": {
1919
"php": ">=5.5.9",
20-
"symfony/console": "~3.0",
21-
"symfony/config": "~3.0",
22-
"symfony/dependency-injection": "~3.0",
23-
"symfony/framework-bundle": "~3.0",
24-
"symfony/http-kernel": "~3.0",
20+
"symfony/console": "~3.3|~4.0",
21+
"symfony/config": "~3.3|~4.0",
22+
"symfony/dependency-injection": "~3.3|~4.0",
23+
"symfony/framework-bundle": "~3.3|~4.0",
24+
"symfony/http-kernel": "~3.3|~4.0",
2525
"symfony/polyfill-php70": "~1.0",
26-
"symfony/security-acl": "~3.0"
26+
"symfony/security-acl": "~2.4",
27+
"symfony/phpunit-bridge": "~3.3|~4.0"
2728
},
2829
"require-dev": {
2930
"doctrine/doctrine-bundle": "~1.4",
30-
"symfony/validator": "~3.0"
31+
"symfony/validator": "~3.3|~4.0"
3132
},
3233
"suggest": {
3334
"doctrine/doctrine-bundle": "To use the default dbal configuration"
@@ -38,7 +39,7 @@
3839
"minimum-stability": "dev",
3940
"extra": {
4041
"branch-alias": {
41-
"dev-master": "3.1-dev"
42+
"dev-master": "3.4-dev"
4243
}
4344
}
4445
}

0 commit comments

Comments
 (0)
0