Skip to content

Instantly share code, notes, and snippets.

@Invis1ble
Last active November 23, 2017 07:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Invis1ble/a45331c49805819f3266fb06ec22bee9 to your computer and use it in GitHub Desktop.
Save Invis1ble/a45331c49805819f3266fb06ec22bee9 to your computer and use it in GitHub Desktop.
Disable Symfony 3.3 AclVoter
<?php
namespace AppBundle;
use Symfony\Component\DependencyInjection\Compiler\PassConfig;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use AppBundle\DependencyInjection\Compiler\DisableAclVoterPass;
class AppBundle extends Bundle
{
public function build(ContainerBuilder $container)
{
parent::build($container);
$container->addCompilerPass(new DisableAclVoterPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 1);
}
}
<?php
namespace AppBundle\DependencyInjection\Compiler;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class DisableAclVoterPass implements CompilerPassInterface
{
public function process(ContainerBuilder $container)
{
$container->findDefinition('security.acl.voter.basic_permissions')
->clearTag('security.voter')
;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment