1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-24 06:20:56 +01:00

T5409, allow bin/remove to permanently destroy credential and everything associated with it

Summary: Fixes T5409, bin/remove permanently destroys credential

Test Plan: Add a passphrase, run bin/remove destroy K123 --trace, verify credential no longer exists

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5409

Differential Revision: https://secure.phabricator.com/D10185
This commit is contained in:
lkassianik 2014-08-07 16:33:54 -07:00 committed by epriestley
parent 20d8b1bdd3
commit c6998207ab
2 changed files with 18 additions and 2 deletions

View file

@ -1,7 +1,8 @@
<?php <?php
final class PassphraseCredential extends PassphraseDAO final class PassphraseCredential extends PassphraseDAO
implements PhabricatorPolicyInterface { implements PhabricatorPolicyInterface,
PhabricatorDestructibleInterface {
protected $name; protected $name;
protected $credentialType; protected $credentialType;
@ -83,4 +84,19 @@ final class PassphraseCredential extends PassphraseDAO
return null; return null;
} }
/* -( PhabricatorDestructibleInterface )----------------------------------- */
public function destroyObjectPermanently(
PhabricatorDestructionEngine $engine) {
$this->openTransaction();
$secrets = id(new PassphraseSecret())->loadAllWhere(
'id = %d',
$this->getSecretID());
foreach ($secrets as $secret) {
$secret->delete();
}
$this->delete();
$this->saveTransaction();
}
} }

View file

@ -11,7 +11,7 @@ interface PhabricatorDestructibleInterface {
// TEMPLATE IMPLEMENTATION ///////////////////////////////////////////////////// // TEMPLATE IMPLEMENTATION /////////////////////////////////////////////////////
/* -( PhabricatorDestructableInterface )----------------------------------- */ /* -( PhabricatorDestructibleInterface )----------------------------------- */
/* /*
public function destroyObjectPermanently( public function destroyObjectPermanently(