bug #16695 [SecurityBundle] disable the init:acl command if ACL is not used (Tobion)

This PR was merged into the 2.3 branch.

Discussion
----------

[SecurityBundle] disable the init:acl command if ACL is not used

| Q             | A
| ------------- | ---
| Bug fix?      | somewhat
| New feature?  | somewhat
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        | -

Related to #16694 but this should go in 2.3 IMO because it was just forgotten. The other acl command already has this logic: https://github.com/symfony/symfony/blob/2.7/src/Symfony/Bundle/SecurityBundle/Command/SetAclCommand.php#L36

It ensures the command list is not flooded with unusable commands.

Commits
-------

55f84a3 [SecurityBundle] disable the init:acl command if ACL is not used
This commit is contained in:
Fabien Potencier 2015-11-26 21:09:40 +01:00
commit 82b6ec192b
1 changed files with 12 additions and 0 deletions

View File

@ -23,6 +23,18 @@ use Doctrine\DBAL\Schema\SchemaException;
*/
class InitAclCommand extends ContainerAwareCommand
{
/**
* {@inheritdoc}
*/
public function isEnabled()
{
if (!$this->getContainer()->has('security.acl.dbal.connection')) {
return false;
}
return parent::isEnabled();
}
/**
* {@inheritdoc}
*/