mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 08:42:41 +01:00
OAuthServer - implement destructible interface on oauth server client objects
Summary: Fixes T6955. Test Plan: made an oauth app. made a test authorization. ran bin/remove destroy <phid of oauth client> and there were no errors. verified oauth app and test authorization were both gone. Reviewers: epriestley Reviewed By: epriestley Subscribers: Korvin, epriestley Maniphest Tasks: T6955 Differential Revision: https://secure.phabricator.com/D11378
This commit is contained in:
parent
38d216f0f1
commit
4655b7e4da
1 changed files with 32 additions and 1 deletions
|
@ -2,7 +2,9 @@
|
|||
|
||||
final class PhabricatorOAuthServerClient
|
||||
extends PhabricatorOAuthServerDAO
|
||||
implements PhabricatorPolicyInterface {
|
||||
implements
|
||||
PhabricatorPolicyInterface,
|
||||
PhabricatorDestructibleInterface {
|
||||
|
||||
protected $secret;
|
||||
protected $name;
|
||||
|
@ -89,4 +91,33 @@ final class PhabricatorOAuthServerClient
|
|||
return null;
|
||||
}
|
||||
|
||||
/* -( PhabricatorDestructibleInterface )----------------------------------- */
|
||||
|
||||
public function destroyObjectPermanently(
|
||||
PhabricatorDestructionEngine $engine) {
|
||||
|
||||
$this->openTransaction();
|
||||
$this->delete();
|
||||
|
||||
$authorizations = id(new PhabricatorOAuthClientAuthorization())
|
||||
->loadAllWhere('clientPHID = %s', $this->getPHID());
|
||||
foreach ($authorizations as $authorization) {
|
||||
$authorization->delete();
|
||||
}
|
||||
|
||||
$tokens = id(new PhabricatorOAuthServerAccessToken())
|
||||
->loadAllWhere('clientPHID = %s', $this->getPHID());
|
||||
foreach ($tokens as $token) {
|
||||
$token->delete();
|
||||
}
|
||||
|
||||
$codes = id(new PhabricatorOAuthServerAuthorizationCode())
|
||||
->loadAllWhere('clientPHID = %s', $this->getPHID());
|
||||
foreach ($codes as $code) {
|
||||
$code->delete();
|
||||
}
|
||||
|
||||
$this->saveTransaction();
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue