Exemple #1
0
 /**
  * Deletes an object-scope ACE.
  *
  * @param \Symfony\Component\Security\Acl\Model\ObjectIdentityInterface|\BackBee\Security\Acl\Domain\AbstractObjectIdentifiable $objectIdentity
  * @param \BackBee\Security\Acl\SecurityIdentityInterface|\Symfony\Component\Security\Acl\Model\UserSecurityIdentity     $sid
  */
 public function deleteObjectAce($objectIdentity, $sid)
 {
     $this->enforceObjectIdentity($objectIdentity);
     $this->enforceSecurityIdentity($sid);
     $acl = $this->getAcl($objectIdentity);
     $found = false;
     foreach ($acl->getObjectAces() as $index => $ace) {
         if ($ace->getSecurityIdentity()->equals($sid)) {
             $acl->deleteObjectAce($index);
             $found = true;
             break;
         }
     }
     if (false === $found) {
         throw new \InvalidArgumentException('ACE not found for the supplied combination of ObjectIdentity and SecurityIdentity');
     }
     $this->securityContext->getACLProvider()->updateAcl($acl);
 }