Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to filter my Doctrine queries with Symfony ACL

Symfony ACL allows me to grant access to an entity, and then check it:

if (false === $securityContext->isGranted('EDIT', $comment)) {
    throw new AccessDeniedException();
}

However, if I have thousands of entities in the database and the user has access only to 10 of them, I don't want to load all the entities in memory and hydrate them.

How can I do a simple "SELECT * FROM X" while filtering only on the entities the user has access (at SQL level)?

like image 350
Matthieu Napoli Avatar asked Feb 13 '13 16:02

Matthieu Napoli


1 Answers

Well there it is: it's not possible.

In the last year I've been working on an alternative ACL system that would allow to filter directly in database queries.

My company recently agreed to open source it, so here it is: http://myclabs.github.io/ACL/

like image 85
Matthieu Napoli Avatar answered Sep 17 '22 20:09

Matthieu Napoli