10000 [Security][Acl] Issue #5787 : Added MutableAclProvider::deleteSecurit… · symfony/symfony@bdbbe58 · GitHub
[go: up one dir, main page]

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)
0