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:
		@@ -1,7 +1,8 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
final class PassphraseCredential extends PassphraseDAO
 | 
			
		||||
  implements PhabricatorPolicyInterface {
 | 
			
		||||
  implements PhabricatorPolicyInterface,
 | 
			
		||||
  PhabricatorDestructibleInterface {
 | 
			
		||||
 | 
			
		||||
  protected $name;
 | 
			
		||||
  protected $credentialType;
 | 
			
		||||
@@ -83,4 +84,19 @@ final class PassphraseCredential extends PassphraseDAO
 | 
			
		||||
    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();
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -11,7 +11,7 @@ interface PhabricatorDestructibleInterface {
 | 
			
		||||
// TEMPLATE IMPLEMENTATION /////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* -(  PhabricatorDestructableInterface  )----------------------------------- */
 | 
			
		||||
/* -(  PhabricatorDestructibleInterface  )----------------------------------- */
 | 
			
		||||
/*
 | 
			
		||||
 | 
			
		||||
  public function destroyObjectPermanently(
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user