summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSébastien Lavoie <github@lavoie.sl>2013-06-18 17:56:09 -0400
committerSébastien Lavoie <github@lavoie.sl>2013-06-19 21:22:41 -0400
commit1112d2c68059f6fe658f7655560084d20091e064 (patch)
tree6f6ebdcb0b0e858c8485fb2fcda80f3d2c193dcb
parent5693e6edd2e4678305ba2c3868ad4d488056ae7e (diff)
downloadsymfony-security-1112d2c68059f6fe658f7655560084d20091e064.zip
symfony-security-1112d2c68059f6fe658f7655560084d20091e064.tar.gz
symfony-security-1112d2c68059f6fe658f7655560084d20091e064.tar.bz2
[Security][Acl] Issue #5787 : Added MutableAclProvider::deleteSecurityIdentity
Code style fix and documentation typo
-rw-r--r--Acl/Dbal/MutableAclProvider.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/Acl/Dbal/MutableAclProvider.php b/Acl/Dbal/MutableAclProvider.php
index 0ac4fa7..f8f2aea 100644
--- a/Acl/Dbal/MutableAclProvider.php
+++ b/Acl/Dbal/MutableAclProvider.php
@@ -109,6 +109,18 @@ class MutableAclProvider extends AclProvider implements MutableAclProviderInterf
}
/**
+ * 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}
*/
public function findAcls(array $oids, array $sids = array())
@@ -596,6 +608,21 @@ QUERY;
}
/**
+ * 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.
*
* @param integer $pk