1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Oro\Bundle\SecurityBundle; |
4
|
|
|
|
5
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
6
|
|
|
use Symfony\Component\HttpKernel\Bundle\Bundle; |
7
|
|
|
|
8
|
|
|
use Oro\Bundle\SecurityBundle\DependencyInjection\Compiler\OwnershipDecisionMakerPass; |
9
|
|
|
use Oro\Bundle\SecurityBundle\DependencyInjection\Compiler\AclConfigurationPass; |
10
|
|
|
use Oro\Bundle\SecurityBundle\DependencyInjection\Compiler\AclAnnotationProviderPass; |
11
|
|
|
use Oro\Bundle\SecurityBundle\DependencyInjection\Compiler\AclGroupProvidersPass; |
12
|
|
|
use Oro\Bundle\SecurityBundle\DependencyInjection\Compiler\OwnerMetadataProvidersPass; |
13
|
|
|
use Oro\Bundle\SecurityBundle\DependencyInjection\Compiler\OwnershipTreeProvidersPass; |
14
|
|
|
use Oro\Bundle\SecurityBundle\DependencyInjection\Security\Factory\OrganizationHttpBasicFactory; |
15
|
|
|
use Oro\Bundle\SecurityBundle\DependencyInjection\Security\Factory\OrganizationFormLoginFactory; |
16
|
|
|
use Oro\Bundle\SecurityBundle\DependencyInjection\Security\Factory\OrganizationRememberMeFactory; |
17
|
|
|
|
18
|
|
|
class OroSecurityBundle extends Bundle |
19
|
|
|
{ |
20
|
|
|
/** |
21
|
|
|
* {@inheritdoc} |
22
|
|
|
*/ |
23
|
|
|
public function __construct() |
24
|
|
|
{ |
25
|
|
|
// Replace original Acl\Domain\Entry on custom class |
26
|
|
|
// to avoid php7 issue with unserialization of the reference object |
27
|
|
|
// https://bugs.php.net/bug.php?id=71940 |
28
|
|
|
if (version_compare(PHP_VERSION, '7.0.0', '>=') && version_compare(PHP_VERSION, '7.0.6', '<') |
29
|
|
|
&& !class_exists('Symfony\Component\Security\Acl\Domain\Entry', false) |
30
|
|
|
) { |
31
|
|
|
class_alias( |
32
|
|
|
'Oro\Bundle\SecurityBundle\Acl\Domain\Entry', |
33
|
|
|
'Symfony\Component\Security\Acl\Domain\Entry' |
34
|
|
|
); |
35
|
|
|
} |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* {@inheritdoc} |
40
|
|
|
*/ |
41
|
|
|
public function build(ContainerBuilder $container) |
42
|
|
|
{ |
43
|
|
|
parent::build($container); |
44
|
|
|
|
45
|
|
|
$container->addCompilerPass(new AclConfigurationPass()); |
46
|
|
|
$container->addCompilerPass(new AclAnnotationProviderPass()); |
47
|
|
|
$container->addCompilerPass(new OwnershipDecisionMakerPass()); |
48
|
|
|
$container->addCompilerPass(new OwnerMetadataProvidersPass()); |
49
|
|
|
$container->addCompilerPass(new OwnershipTreeProvidersPass()); |
50
|
|
|
$container->addCompilerPass(new AclGroupProvidersPass()); |
51
|
|
|
$extension = $container->getExtension('security'); |
52
|
|
|
$extension->addSecurityListenerFactory(new OrganizationFormLoginFactory()); |
53
|
|
|
$extension->addSecurityListenerFactory(new OrganizationHttpBasicFactory()); |
54
|
|
|
$extension->addSecurityListenerFactory(new OrganizationRememberMeFactory()); |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|