Permalink
Browse files

Added a user provider

  • Loading branch information...
1 parent 0fe45e0 commit 7f7cef3363ffd84a338b3ddf77a17daab6175949 @stof stof committed Dec 19, 2011
Showing with 14 additions and 1 deletion.
  1. +6 −1 DoctrineCouchDBBundle.php
  2. +8 −0 Resources/config/odm.xml
View
7 DoctrineCouchDBBundle.php
@@ -19,13 +19,18 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Doctrine\Bundle\CouchDBBundle\DependencyInjection\Compiler\RegisterEventListenersAndSubscribersPass;
use Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\DoctrineValidationPass;
+use Symfony\Bridge\Doctrine\DependencyInjection\Security\UserProvider\EntityFactory;
class DoctrineCouchDBBundle extends Bundle
{
public function build(ContainerBuilder $container)
{
parent::build($container);
+ if ($container->hasExtension('security')) {
+ $container->getExtension('security')->addUserProviderFactory(new EntityFactory('couchdb', 'doctrine_couchdb.odm.security.user.provider'));
+ }
+
$container->addCompilerPass(new RegisterEventListenersAndSubscribersPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION);
$container->addCompilerPass(new DoctrineValidationPass('couchdb'));
}
@@ -35,7 +40,7 @@ public function boot()
// force Doctrine annotations to be loaded
// should be removed when a better solution is found in Doctrine
class_exists('Doctrine\ODM\CouchDB\Mapping\Driver\AnnotationDriver');
-
+
// Register an autoloader for proxies to avoid issues when unserializing them
// when the ORM is used.
if ($this->container->hasParameter('doctrine_couchdb.odm.proxy_namespace')) {
View
8 Resources/config/odm.xml
@@ -20,6 +20,9 @@
<parameter key="doctrine_couchdb.odm.cache.xcache.class">Doctrine\Common\Cache\XcacheCache</parameter>
<parameter key="doctrine_couchdb.odm.proxy_cache_warmer.class">Doctrine\Bundle\CouchDBBundle\CacheWarmer\ProxyCacheWarmer</parameter>
+ <!-- security -->
+ <parameter key="doctrine_couchdb.odm.user_provider.class">Symfony\Bridge\Doctrine\Security\User\EntityUserProvider</parameter>
+
<!-- form field factory guesser -->
<parameter key="form.type_guesser.doctrine_couchdb.class">Doctrine\Bundle\CouchDBBundle\Form\CouchDBTypeGuesser</parameter>
@@ -82,5 +85,10 @@
<argument type="service" id="doctrine_couchdb" />
</service>
+ <!-- security -->
+ <service id="doctrine_couchdb.odm.security.user.provider" class="%doctrine.orm.security.user.provider.class%" abstract="true" public="false">
+ <argument type="service" id="doctrine_couchdb" />
+ </service>
+
</services>
</container>

0 comments on commit 7f7cef3

Please sign in to comment.