Skip to content

PermissionEvaluator throws no ACL exception because a doctrine proxy is passed #26

Closed
jonathaningram opened this Issue Dec 1, 2011 · 3 comments

2 participants

@jonathaningram

The method signature of interest is:

<?php

public function hasPermission(TokenInterface $token, $object, $permission) { }

And we are interested in $object. In most of my expressions, it works fine because the entity was loaded beforehand. E.g. in #project.getCompany(), the company is loaded previously and so is of type Jbi\CoreBundle\Entity\Company (i.e. not a proxy).

However, in my latest expression, I have #site.getProject() and when hasPermission is called, the $object is of type Proxies\JbiCoreBundleEntityProjectProxy and therefore when trying to find the ACL for the OID, it fails telling me that no ACL exists.

So - I could see how your response may be something like "hasPermission has a precondition that $object is of the correct type, not a proxy".

What do you think? Is there a way around or is there a way within this method that would check for a proxy?

@schmittjoh
Owner
@jonathaningram

Apologies - I thought perhaps it might be an issue with JMS. Is there a JMS mailing list or is it just the Symfony2 one?

If you don't mind, I'll just finish this here? I suppose it would be as simple as overriding the security.acl.object_identity_retrieval_strategy core service with my own service?

@schmittjoh
Owner

Yes exactly.

@schmittjoh schmittjoh closed this Dec 2, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.