2013-04-19 20:40:13 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorExternalAccount extends PhabricatorUserDAO {
|
|
|
|
|
2013-04-28 22:22:05 +02:00
|
|
|
protected $userPHID;
|
|
|
|
protected $accountType;
|
|
|
|
protected $accountDomain;
|
|
|
|
protected $accountSecret;
|
|
|
|
protected $accountID;
|
|
|
|
protected $displayName;
|
2013-06-14 15:55:18 +02:00
|
|
|
protected $username;
|
|
|
|
protected $realName;
|
|
|
|
protected $email;
|
|
|
|
protected $emailVerified = 0;
|
|
|
|
protected $accountURI;
|
|
|
|
protected $profileImagePHID;
|
|
|
|
protected $properties = array();
|
2013-04-19 20:40:13 +02:00
|
|
|
|
2013-04-20 04:50:21 +02:00
|
|
|
public function generatePHID() {
|
2013-04-19 20:40:13 +02:00
|
|
|
return PhabricatorPHID::generateNewPHID(
|
|
|
|
PhabricatorPHIDConstants::PHID_TYPE_XUSR);
|
2013-04-20 04:50:21 +02:00
|
|
|
}
|
2013-04-28 22:22:05 +02:00
|
|
|
|
|
|
|
public function getConfiguration() {
|
|
|
|
return array(
|
|
|
|
self::CONFIG_AUX_PHID => true,
|
2013-06-14 15:55:18 +02:00
|
|
|
self::CONFIG_SERIALIZATION => array(
|
|
|
|
'properties' => self::SERIALIZATION_JSON,
|
|
|
|
),
|
2013-04-28 22:22:05 +02:00
|
|
|
) + parent::getConfiguration();
|
|
|
|
}
|
|
|
|
|
2013-05-06 20:34:48 +02:00
|
|
|
public function getPhabricatorUser() {
|
|
|
|
$tmp_usr = id(new PhabricatorUser())
|
|
|
|
->makeEphemeral()
|
|
|
|
->setPHID($this->getPHID());
|
|
|
|
return $tmp_usr;
|
|
|
|
}
|
|
|
|
|
2013-06-14 15:55:18 +02:00
|
|
|
public function save() {
|
|
|
|
if (!$this->getAccountSecret()) {
|
|
|
|
$this->setAccountSecret(Filesystem::readRandomCharacters(32));
|
|
|
|
}
|
|
|
|
return parent::save();
|
|
|
|
}
|
|
|
|
|
2013-04-19 20:40:13 +02:00
|
|
|
}
|