Skip to content

Commit

Permalink
[Security][Acl] Issue symfony#5787 : Added MutableAclProvider::delete…
Browse files Browse the repository at this point in the history
…SecurityIdentity

Code style fix and documentation typo
  • Loading branch information
lavoiesl committed Jun 20, 2013
1 parent d744ffa commit bdbbe58
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/Symfony/Component/Security/Acl/Dbal/MutableAclProvider.php
Expand Up @@ -108,6 +108,18 @@ public function deleteAcl(ObjectIdentityInterface $oid)
}
}

/**
* Deletes the security identity from the database.
* ACL entries have the CASCADE option on their foreign key so they will also get deleted
*
* @param SecurityIdentityInterface $sid
* @throws \InvalidArgumentException
*/
public function deleteSecurityIdentity(SecurityIdentityInterface $sid)
{
$this->connection->executeQuery($this->getDeleteSecurityIdentityIdSql($sid));
}

/**
* {@inheritDoc}
*/
Expand Down Expand Up @@ -595,6 +607,21 @@ protected function getSelectSecurityIdentityIdSql(SecurityIdentityInterface $sid
);
}

/**
* Constructs the SQL to delete a security identity.
*
* @param SecurityIdentityInterface $sid
* @throws \InvalidArgumentException
* @return string
*/
protected function getDeleteSecurityIdentityIdSql(SecurityIdentityInterface $sid)
{
$select = $this->getSelectSecurityIdentityIdSql($sid);
$delete = preg_replace('/^SELECT id FROM/', 'DELETE FROM', $select);

return $delete;
}

/**
* Constructs the SQL for updating an object identity.
*
Expand Down

0 comments on commit bdbbe58

Please sign in to comment.