From 3b68f6ca727f52f9dc84fa1a134c092b44c49103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Sat, 16 Jun 2018 11:40:00 +0200 Subject: Add ldap --- .../DependencyInjection/WallabagUserExtension.php | 30 +++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'src/Wallabag/UserBundle/DependencyInjection') 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']); } -- cgit v1.2.3