3 final class PhabricatorExternalAccountIdentifier
4 extends PhabricatorUserDAO
6 PhabricatorPolicyInterface
,
7 PhabricatorDestructibleInterface
{
9 protected $externalAccountPHID;
10 protected $providerConfigPHID;
11 protected $identifierHash;
12 protected $identifierRaw;
14 public function getPHIDType() {
15 return PhabricatorPeopleExternalIdentifierPHIDType
::TYPECONST
;
18 protected function getConfiguration() {
20 self
::CONFIG_AUX_PHID
=> true,
21 self
::CONFIG_COLUMN_SCHEMA
=> array(
22 'identifierHash' => 'bytes12',
23 'identifierRaw' => 'text',
25 self
::CONFIG_KEY_SCHEMA
=> array(
26 'key_identifier' => array(
27 'columns' => array('providerConfigPHID', 'identifierHash'),
30 'key_account' => array(
31 'columns' => array('externalAccountPHID'),
34 ) + parent
::getConfiguration();
37 public function save() {
38 $identifier_raw = $this->getIdentifierRaw();
40 $identifier_hash = PhabricatorHash
::digestForIndex($identifier_raw);
41 $this->setIdentifierHash($identifier_hash);
43 return parent
::save();
47 /* -( PhabricatorPolicyInterface )----------------------------------------- */
49 // TODO: These permissions aren't very good. They should just be the same
50 // as the associated ExternalAccount. See T13381.
52 public function getCapabilities() {
54 PhabricatorPolicyCapability
::CAN_VIEW
,
55 PhabricatorPolicyCapability
::CAN_EDIT
,
59 public function getPolicy($capability) {
60 switch ($capability) {
61 case PhabricatorPolicyCapability
::CAN_VIEW
:
62 return PhabricatorPolicies
::getMostOpenPolicy();
63 case PhabricatorPolicyCapability
::CAN_EDIT
:
64 return PhabricatorPolicies
::POLICY_NOONE
;
68 public function hasAutomaticCapability($capability, PhabricatorUser
$viewer) {
73 /* -( PhabricatorDestructibleInterface )----------------------------------- */
76 public function destroyObjectPermanently(
77 PhabricatorDestructionEngine
$engine) {