Skip to content

Commit bdbbe58

Browse files
committed
[Security][Acl] Issue #5787 : Added MutableAclProvider::deleteSecurityIdentity
Code style fix and documentation typo
1 parent d744ffa commit bdbbe58

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/Symfony/Component/Security/Acl/Dbal/MutableAclProvider.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,18 @@ public function deleteAcl(ObjectIdentityInterface $oid)
108108
}
109109
}
110110

111+
/**
112+
* Deletes the security identity from the database.
113+
* ACL entries have the CASCADE option on their foreign key so they will also get deleted
114+
*
115+
* @param SecurityIdentityInterface $sid
116+
* @throws \InvalidArgumentException
117+
*/
118+
public function deleteSecurityIdentity(SecurityIdentityInterface $sid)
119+
{
120+
$this->connection->executeQuery($this->getDeleteSecurityIdentityIdSql($sid));
121+
}
122+
111123
/**
112124
* {@inheritDoc}
113125
*/
@@ -595,6 +607,21 @@ protected function getSelectSecurityIdentityIdSql(SecurityIdentityInterface $sid
595607
);
596608
}
597609

610+
/**
611+
* Constructs the SQL to delete a security identity.
612+
*
613+
* @param SecurityIdentityInterface $sid
614+
* @throws \InvalidArgumentException
615+
* @return string
616+
*/
617+
protected function getDeleteSecurityIdentityIdSql(SecurityIdentityInterface $sid)
618+
{
619+
$select = $this->getSelectSecurityIdentityIdSql($sid);
620+
$delete = preg_replace('/^SELECT id FROM/', 'DELETE FROM', $select);
621+
622+
return $delete;
623+
}
624+
598625
/**
599626
* Constructs the SQL for updating an object identity.
600627
*

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy