Skip to content

Commit

Permalink
fix: use the object identity to delete ACL
Browse files Browse the repository at this point in the history
  • Loading branch information
Roel Sint committed Dec 28, 2011
1 parent 32ef4b5 commit 03377a3
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Admin/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -530,9 +530,9 @@ public function create($object)
public function delete($object)
{
$this->preRemove($object);
$this->getSecurityHandler()->deleteObjectSecurity($this, $object);
$this->getModelManager()->delete($object);
$this->postRemove($object);
$this->getSecurityHandler()->deleteObjectSecurity($this, $object);
}

public function preUpdate($object)
Expand Down
9 changes: 3 additions & 6 deletions Security/Handler/AclSecurityHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,7 @@ public function createObjectSecurity(AdminInterface $admin, $object)
public function deleteObjectSecurity(AdminInterface $admin, $object)
{
$objectIdentity = ObjectIdentity::fromDomainObject($object);
if (!is_null($acl = $this->getObjectAcl($objectIdentity)))
{
$this->deleteAcl($acl);
}
$this->deleteAcl($objectIdentity);
}

/**
Expand Down Expand Up @@ -250,9 +247,9 @@ public function updateAcl(AclInterface $acl)
/**
* {@inheritDoc}
*/
public function deleteAcl(AclInterface $acl)
public function deleteAcl(ObjectIdentityInterface $objectIdentity)
{
$this->aclProvider->deleteAcl($acl);
$this->aclProvider->deleteAcl($objectIdentity);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions Security/Handler/AclSecurityHandlerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ function updateAcl(AclInterface $acl);
* Delete the ACL
*
* @abstract
* @param AclInterface $acl
* @param ObjectIdentityInterface $objectIdentity
* @return void
*/
function deleteAcl(AclInterface $acl);
function deleteAcl(ObjectIdentityInterface $objectIdentity);

/**
* Helper method to find the index of a class ACE for a role
Expand Down
2 changes: 1 addition & 1 deletion Util/AdminAclManipulator.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function configureAcls(OutputInterface $output, AdminInterface $admin)
$this->securityHandler->updateAcl($acl);
} else {
$output->writeln(sprintf(' - %s , no roles and permissions found', ($newAcl ? 'skip' : 'removed')));
$this->securityHandler->deleteAcl($acl);
$this->securityHandler->deleteAcl($objectIdentity);
}
}

Expand Down

0 comments on commit 03377a3

Please sign in to comment.