Changeset View
Changeset View
Standalone View
Standalone View
src/applications/people/storage/PhabricatorExternalAccount.php
| <?php | <?php | ||||
| final class PhabricatorExternalAccount extends PhabricatorUserDAO | final class PhabricatorExternalAccount | ||||
| implements PhabricatorPolicyInterface { | extends PhabricatorUserDAO | ||||
| implements | |||||
| PhabricatorPolicyInterface, | |||||
| PhabricatorDestructibleInterface { | |||||
| protected $userPHID; | protected $userPHID; | ||||
| protected $accountType; | protected $accountType; | ||||
| protected $accountDomain; | protected $accountDomain; | ||||
| protected $accountSecret; | protected $accountSecret; | ||||
| protected $accountID; | protected $accountID; | ||||
| protected $displayName; | protected $displayName; | ||||
| protected $username; | protected $username; | ||||
| ▲ Show 20 Lines • Show All 144 Lines • ▼ Show 20 Lines | switch ($capability) { | ||||
| case PhabricatorPolicyCapability::CAN_VIEW: | case PhabricatorPolicyCapability::CAN_VIEW: | ||||
| return null; | return null; | ||||
| case PhabricatorPolicyCapability::CAN_EDIT: | case PhabricatorPolicyCapability::CAN_EDIT: | ||||
| return pht( | return pht( | ||||
| 'External accounts can only be edited by the account owner.'); | 'External accounts can only be edited by the account owner.'); | ||||
| } | } | ||||
| } | } | ||||
| /* -( PhabricatorDestructibleInterface )----------------------------------- */ | |||||
| public function destroyObjectPermanently( | |||||
| PhabricatorDestructionEngine $engine) { | |||||
| $viewer = $engine->getViewer(); | |||||
| $identifiers = id(new PhabricatorExternalAccountIdentifierQuery()) | |||||
| ->setViewer($viewer) | |||||
| ->withExternalAccountPHIDs(array($this->getPHID())) | |||||
| ->newIterator(); | |||||
| foreach ($identifiers as $identifier) { | |||||
| $engine->destroyObject($identifier); | |||||
| } | |||||
| $this->delete(); | |||||
| } | |||||
| } | } | ||||