-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AclSonataAdmin and Inheritance #17
Comments
This bundle doesn't support inheritance (at least, AFAIK this has never been tested). But feedback and PRs about inheritance support are very welcome. |
Thanks for your quick answer, I'll try to find a way and feed you back if I get something functional ! |
overriding the postPersist method of carAdmin (sandbox) with: /**
* {@inheritdoc}
*/
public function postPersist($object)
{
if ($this->isAclEnabled()) {
$objectIdentity = new ObjectIdentity($object->getId(), get_parent_class($object));
$acl = $this->getSecurityHandler()->createAcl($objectIdentity);
$user = $this->tokenStorage->getToken()->getUser();
$securityIdentity = UserSecurityIdentity::fromAccount($user);
$this->getSecurityHandler()->addObjectOwner($acl, $securityIdentity);
$this->getSecurityHandler()->addObjectClassAces($acl, $this->getSecurityHandler()->buildSecurityInformation($this));
$this->getSecurityHandler()->updateAcl($acl);
}
} seems to do the trick (the car list is not empty anymore...), with injection of tokenStorage in the admin class. It could be done exactly the same way but with a very sligth modification of the createObjectSecurity method of AclSecurityHandler class if it could allow creation of the $objectIdentity = new ObjectIdentity($object->getId(), get_parent_class($object)) ... What do you think ? |
Looking for same functionality. |
Can you open a PR to add this feature upstream? Cc @MrGreenStuff |
Not really the same issue I think : MrGreen addresses the "embedded admin" (with relation 1 to N between "Parent" and "Child" Entities (that are both concrete Classes without inheritance between both). As the ACL Classes are totally seggregated from the DomainObjects, my proposal is to accept (in AclSecurityHandler) that an abstract class in the DomainObject (the parent) would have acl entries (for the object ids of their children) attached to it, as if it was a concrete one. |
@dunglas - it seems that https://github.com/MrGreenStuff/MrGreenStuffAclSonataAdminExtensionBundle is a bit abandoned. Is it possible to merge that fork here without the author itself? |
Yes as long as it's the same license it should be ok. |
@dunglas - I've already propose a PR 2 year ago with my fork but it was not accepted because it's for specific case. My Fork it's not well optimized but now you can use this bundle https://github.com/GoDisco/AclTreeBundle and modify my bundle to use it or make a new fork of this bundle and use it in. It's will be more optimized and usable not only in the sonata admin. |
The old PR if you want to merge : #10 |
I already implemented a |
@dunglas, any news on merging that PR? |
If you're speaking about #10, it needs some work before being merged (see my comments on that PR). I'll take a look at the security issue asap. |
I have a bundle like the SonataProductBundle where in the sandbox "Travels" and "Goodies" entities have the "Product" entity as parent. When I enable the AclSonataAdminExtension and go to the ProductAdmin, I have an empty list of Products (even if I am OWNER of a list of sub-entities Travels & Goodies for example) because the Acl is managed at the entity level I guess.
Is there a way to avoid this ?
The text was updated successfully, but these errors were encountered: