diff options
Diffstat (limited to 'src/Wallabag/UserBundle/DependencyInjection/WallabagUserExtension.php')
-rw-r--r-- | src/Wallabag/UserBundle/DependencyInjection/WallabagUserExtension.php | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/src/Wallabag/UserBundle/DependencyInjection/WallabagUserExtension.php b/src/Wallabag/UserBundle/DependencyInjection/WallabagUserExtension.php index 5ca3482e..904a6af1 100644 --- a/src/Wallabag/UserBundle/DependencyInjection/WallabagUserExtension.php +++ b/src/Wallabag/UserBundle/DependencyInjection/WallabagUserExtension.php | |||
@@ -6,9 +6,34 @@ use Symfony\Component\Config\FileLocator; | |||
6 | use Symfony\Component\DependencyInjection\ContainerBuilder; | 6 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
7 | use Symfony\Component\DependencyInjection\Loader; | 7 | use Symfony\Component\DependencyInjection\Loader; |
8 | use Symfony\Component\HttpKernel\DependencyInjection\Extension; | 8 | use Symfony\Component\HttpKernel\DependencyInjection\Extension; |
9 | use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; | ||
9 | 10 | ||
10 | class WallabagUserExtension extends Extension | 11 | class WallabagUserExtension extends Extension implements PrependExtensionInterface |
11 | { | 12 | { |
13 | public function prepend(ContainerBuilder $container) | ||
14 | { | ||
15 | $ldap = $container->getParameter('ldap_enabled'); | ||
16 | |||
17 | if ($ldap) { | ||
18 | $container->prependExtensionConfig('security', array( | ||
19 | 'providers' => array( | ||
20 | 'chain_provider' => array(), | ||
21 | ), | ||
22 | )); | ||
23 | $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); | ||
24 | $loader->load('ldap.yml'); | ||
25 | } elseif ($container->hasExtension('fr3d_ldap')) { | ||
26 | $container->prependExtensionConfig('fr3_d_ldap', array( | ||
27 | 'driver' => array( | ||
28 | 'host' => 'localhost', | ||
29 | ), | ||
30 | 'user' => array( | ||
31 | 'baseDn' => 'dc=example,dc=com', | ||
32 | ), | ||
33 | )); | ||
34 | } | ||
35 | } | ||
36 | |||
12 | public function load(array $configs, ContainerBuilder $container) | 37 | public function load(array $configs, ContainerBuilder $container) |
13 | { | 38 | { |
14 | $configuration = new Configuration(); | 39 | $configuration = new Configuration(); |
@@ -16,6 +41,9 @@ class WallabagUserExtension extends Extension | |||
16 | 41 | ||
17 | $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); | 42 | $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
18 | $loader->load('services.yml'); | 43 | $loader->load('services.yml'); |
44 | if ($container->getParameter('ldap_enabled')) { | ||
45 | $loader->load('ldap_services.yml'); | ||
46 | } | ||
19 | $container->setParameter('wallabag_user.registration_enabled', $config['registration_enabled']); | 47 | $container->setParameter('wallabag_user.registration_enabled', $config['registration_enabled']); |
20 | } | 48 | } |
21 | 49 | ||