The code of the official ACL example works : http://symfony.com/doc/current/cookbook/security/acl.html
If I do that, no problem...
{% if is_granted('EDIT', comment) %}
Edit
{% endif %}
... but if I want a "Granted Access" to an associated object, it doesn't work.
{% for comment in news.comments %}
comment.content
{% if is_granted('EDIT', comment) %}
Edit
{% endif %}
{% endfor %}
I think the twig extension can't know that "comment" is a "Comment Entity".
The query searches "Proxies\JblNewsBundleEntityCommentProxy" instead of "Jbl\NewsBundle\Entity\Comment" :
SELECT a.ancestor_id FROM acl_object_identities o INNER JOIN acl_classes c ON c.id = o.class_id INNER JOIN acl_object_identity_ancestors a ON a.object_identity_id = o.id WHERE ((o.object_identifier = '38' AND c.class_type = 'Proxies\\JblNewsBundleEntityCommentProxy'))
But I don't know how to fix that.
Have you a solution, please ?
It's fixed in symfony 2.1.
For old, 2.0 version the fix is here:
Overriding the ObjectIdentityRetrievalStrategy to check if a domain object is a Doctrine proxy
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With