X-Git-Url: https://git.immae.eu/?p=github%2Fwallabag%2Fwallabag.git;a=blobdiff_plain;f=src%2FWallabag%2FUserBundle%2FDependencyInjection%2FWallabagUserExtension.php;fp=src%2FWallabag%2FUserBundle%2FDependencyInjection%2FWallabagUserExtension.php;h=904a6af191a7a9f1f77ea0fc5155c0a0a9a892c6;hp=5ca3482e6240a5c4abffdc7e9ee6666a51c92944;hb=3b68f6ca727f52f9dc84fa1a134c092b44c49103;hpb=3f7a28de8473db53b3de9e19d5e8e58b4e21090d 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; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader; use Symfony\Component\HttpKernel\DependencyInjection\Extension; +use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; -class WallabagUserExtension extends Extension +class WallabagUserExtension extends Extension implements PrependExtensionInterface { + public function prepend(ContainerBuilder $container) + { + $ldap = $container->getParameter('ldap_enabled'); + + if ($ldap) { + $container->prependExtensionConfig('security', array( + 'providers' => array( + 'chain_provider' => array(), + ), + )); + $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); + $loader->load('ldap.yml'); + } elseif ($container->hasExtension('fr3d_ldap')) { + $container->prependExtensionConfig('fr3_d_ldap', array( + 'driver' => array( + 'host' => 'localhost', + ), + 'user' => array( + 'baseDn' => 'dc=example,dc=com', + ), + )); + } + } + public function load(array $configs, ContainerBuilder $container) { $configuration = new Configuration(); @@ -16,6 +41,9 @@ class WallabagUserExtension extends Extension $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); $loader->load('services.yml'); + if ($container->getParameter('ldap_enabled')) { + $loader->load('ldap_services.yml'); + } $container->setParameter('wallabag_user.registration_enabled', $config['registration_enabled']); }