Just wondering if anyone out there has used Doctrine in a multi-tenancy application? That is, you have a single MySQL database, but many users and want to isolate the user data in a (programmer and injection) safe way.
How have you achieved it and did Doctrine play a big role in facilitating this (other than just being an ORM)?
In an app I'm developing I use an RBAC structure based on roles strictly connected to specific accessible records, and Doctrine 2 made almost all the job. The problem is that I had to rewrite all my customRepositories and avoid any access to base functionalities of repositories, like findBy and similar methods ($em->find($entity, $id) can't be used in my app, or at least ist strongly discouraged!). It's not completely safe, but I build up all my queries joining with ACL tables. Another solution I didn't test is using AST and hints, but I had to run while I was in the first stages of development, and avoided this kind of approach...
Here's some example of a custom repository:* <?php namespace Deneb\EntityRepository;
Not really a masterpiece, but it does the work and I just use the QueryBuilder it provides me being careful not to replace existing parameters. That makes stuff so much easier!
> Just wondering if anyone out there has used Doctrine in a multi-tenancy > application? That is, you have a single MySQL database, but many users and > want to isolate the user data in a (programmer and injection) safe way.
> How have you achieved it and did Doctrine play a big role in facilitating > this (other than just being an ORM)?
> Thanks in advance, > Cheers, > Chris
> -- > You received this message because you are subscribed to the Google Groups > "doctrine-user" group. > To post to this group, send email to doctrine-user@googlegroups.com. > To unsubscribe from this group, send email to > doctrine-user+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/doctrine-user?hl=en.
> In an app I'm developing I use an RBAC structure based on roles > strictly connected to specific accessible records, and Doctrine 2 > made > almost all the job. > The problem is that I had to rewrite all my customRepositories and > avoid any access to base functionalities of repositories, like findBy > and similar methods ($em->find($entity, $id) can't be used in my app, > or at least ist strongly discouraged!). > It's not completely safe, but I build up all my queries joining with > ACL tables. > Another solution I didn't test is using AST and hints, but I had to > run while I was in the first stages of development, and avoided this > kind of approach...
> but this doesnt help with protecting associations.
> On Wed, 8 Jun 2011 12:17:01 +0200, Marco Pivetta wrote:
>> In an app I'm developing I use an RBAC structure based on roles >> strictly connected to specific accessible records, and Doctrine 2 made >> almost all the job. >> The problem is that I had to rewrite all my customRepositories and >> avoid any access to base functionalities of repositories, like findBy >> and similar methods ($em->find($entity, $id) can't be used in my app, >> or at least ist strongly discouraged!). >> It's not completely safe, but I build up all my queries joining with >> ACL tables. >> Another solution I didn't test is using AST and hints, but I had to >> run while I was in the first stages of development, and avoided this >> kind of approach...
> -- > You received this message because you are subscribed to the Google Groups > "doctrine-user" group. > To post to this group, send email to doctrine-user@googlegroups.com. > To unsubscribe from this group, send email to > doctrine-user+unsubscribe@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/doctrine-user?hl=en.