zerodine / MongoDBAclBundle

This bundle allows the use of MongoDB as the storage layer for the Symfony ACLs component.
21 stars 32 forks source link

ACEs are not deleted when deleting ACL on Class (not instance object) #36

Open adteulade opened 10 years ago

adteulade commented 10 years ago

Hi, first of all, thanks a lot for your work on this bundle which is precious!

Still, I'm experiencing an issue with ACL and ACEs applied on Class.

When I'm deleting an ACL applied on a Class (not an instance object), I expect it to delete each linked ACEs from it. But, apparently, it doesn't work. After some searches, I found that in MongoDB, the Document created inside "acl_entry" Collection has a field called "class" with my Class namespace. That's cool.

But since there's no reference to the Object Identity Document (registered in the "acl_oid" Collection) inside any of the ACE Document fields (from "acl_entry" Collection), when I try to call deleteAcl() method from the ACL Provider, I expect it to delete the ACL, the Object Identity and all of its ACEs.

Instead, it deletes the Object Identity perfectly, BUT finds no reference to this Object Identity in the ACEs list (since it's just a string field called "class"), and thus, all of its ACEs are still registered in the Database after the deletion.

Can you explain to me the correct way to achieve a cascading deletion directly by deleting the ACL?

After trying to find out why this behavior happens, I found this line in your code (file IamPersistent\MongoDBAclBundle\Security\Acl\MutableAclProvider, line 461) returning NULL when $name === "classAces".

Is it the explanation?