2013-06-17 10:48:41 -07:00
|
|
|
<?php
|
|
|
|
|
Transactions - deploy buildTransactionTimeline against a few more applications
Summary:
Ref T4712. Thus far, it seems that most "non-standard" things can be done pretty easily in the controller. Aside from deploying, this diff had to fix a few bugs / missing implementations of stuff.
(Notably, PhabricatorAuthProviderConfig, HeraldRule, PhabricatorSlowvotePoll, and AlmanacNetwork needed to implement PhabricatorApplicationTransactionInterface, PhabricatorAuthAuthProviderPHIDType had to be added, and a rendering bug in transactions of type PhabricatorOAuth2AuthProvider had to be fixed.)
Test Plan: Almanac - looked at binding, device, network, and service view controllers and verified timeline displayed properly. Herald - looked at a rule and verified timeline. Slowvote - looked at a vote and verified timeline. Auth - looked at an auth provider (Facebook) and verified proper display of transactions within timeline.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T4712
Differential Revision: https://secure.phabricator.com/D10921
2014-12-02 14:33:59 -08:00
|
|
|
final class PhabricatorAuthProviderConfig
|
|
|
|
extends PhabricatorAuthDAO
|
|
|
|
implements
|
|
|
|
PhabricatorApplicationTransactionInterface,
|
|
|
|
PhabricatorPolicyInterface {
|
2013-06-17 10:48:41 -07:00
|
|
|
|
|
|
|
protected $providerClass;
|
|
|
|
protected $providerType;
|
|
|
|
protected $providerDomain;
|
|
|
|
|
2013-06-17 10:53:29 -07:00
|
|
|
protected $isEnabled;
|
2013-06-17 10:48:41 -07:00
|
|
|
protected $shouldAllowLogin = 0;
|
|
|
|
protected $shouldAllowRegistration = 0;
|
|
|
|
protected $shouldAllowLink = 0;
|
|
|
|
protected $shouldAllowUnlink = 0;
|
2014-05-16 14:14:06 -07:00
|
|
|
protected $shouldTrustEmails = 0;
|
2015-02-06 10:50:36 -08:00
|
|
|
protected $shouldAutoLogin = 0;
|
2013-06-17 10:48:41 -07:00
|
|
|
|
|
|
|
protected $properties = array();
|
|
|
|
|
2013-06-17 10:53:29 -07:00
|
|
|
private $provider;
|
|
|
|
|
2013-06-17 10:48:41 -07:00
|
|
|
public function generatePHID() {
|
|
|
|
return PhabricatorPHID::generateNewPHID(
|
Transactions - deploy buildTransactionTimeline against a few more applications
Summary:
Ref T4712. Thus far, it seems that most "non-standard" things can be done pretty easily in the controller. Aside from deploying, this diff had to fix a few bugs / missing implementations of stuff.
(Notably, PhabricatorAuthProviderConfig, HeraldRule, PhabricatorSlowvotePoll, and AlmanacNetwork needed to implement PhabricatorApplicationTransactionInterface, PhabricatorAuthAuthProviderPHIDType had to be added, and a rendering bug in transactions of type PhabricatorOAuth2AuthProvider had to be fixed.)
Test Plan: Almanac - looked at binding, device, network, and service view controllers and verified timeline displayed properly. Herald - looked at a rule and verified timeline. Slowvote - looked at a vote and verified timeline. Auth - looked at an auth provider (Facebook) and verified proper display of transactions within timeline.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T4712
Differential Revision: https://secure.phabricator.com/D10921
2014-12-02 14:33:59 -08:00
|
|
|
PhabricatorAuthAuthProviderPHIDType::TYPECONST);
|
2013-06-17 10:48:41 -07:00
|
|
|
}
|
|
|
|
|
2015-01-14 06:47:05 +11:00
|
|
|
protected function getConfiguration() {
|
2013-06-17 10:48:41 -07:00
|
|
|
return array(
|
2013-06-17 10:52:38 -07:00
|
|
|
self::CONFIG_AUX_PHID => true,
|
2013-06-17 10:48:41 -07:00
|
|
|
self::CONFIG_SERIALIZATION => array(
|
|
|
|
'properties' => self::SERIALIZATION_JSON,
|
|
|
|
),
|
2014-09-18 08:32:44 -07:00
|
|
|
self::CONFIG_COLUMN_SCHEMA => array(
|
|
|
|
'isEnabled' => 'bool',
|
2014-09-18 11:15:49 -07:00
|
|
|
'providerClass' => 'text128',
|
Fix almost all remaining schemata issues
Summary:
Ref T1191. This fixes nearly every remaining blocker for utf8mb4 -- primarily, overlong keys.
Remaining issue is https://secure.phabricator.com/T1191#77467
Test Plan: I'll annotate inline.
Reviewers: btrahan
Reviewed By: btrahan
Subscribers: epriestley, hach-que
Maniphest Tasks: T6099, T6129, T6133, T6134, T6150, T6148, T6147, T6146, T6105, T1191
Differential Revision: https://secure.phabricator.com/D10601
2014-10-01 08:18:36 -07:00
|
|
|
'providerType' => 'text32',
|
2014-09-18 11:15:49 -07:00
|
|
|
'providerDomain' => 'text128',
|
2014-09-18 08:32:44 -07:00
|
|
|
'shouldAllowLogin' => 'bool',
|
|
|
|
'shouldAllowRegistration' => 'bool',
|
|
|
|
'shouldAllowLink' => 'bool',
|
|
|
|
'shouldAllowUnlink' => 'bool',
|
|
|
|
'shouldTrustEmails' => 'bool',
|
2015-02-06 10:50:36 -08:00
|
|
|
'shouldAutoLogin' => 'bool',
|
2014-09-18 08:32:44 -07:00
|
|
|
),
|
2014-10-01 07:53:50 -07:00
|
|
|
self::CONFIG_KEY_SCHEMA => array(
|
|
|
|
'key_provider' => array(
|
|
|
|
'columns' => array('providerType', 'providerDomain'),
|
|
|
|
'unique' => true,
|
|
|
|
),
|
|
|
|
'key_class' => array(
|
|
|
|
'columns' => array('providerClass'),
|
|
|
|
),
|
|
|
|
),
|
2013-06-17 10:48:41 -07:00
|
|
|
) + parent::getConfiguration();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getProperty($key, $default = null) {
|
|
|
|
return idx($this->properties, $key, $default);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setProperty($key, $value) {
|
|
|
|
$this->properties[$key] = $value;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2013-06-17 10:53:29 -07:00
|
|
|
public function getProvider() {
|
|
|
|
if (!$this->provider) {
|
|
|
|
$base = PhabricatorAuthProvider::getAllBaseProviders();
|
|
|
|
$found = null;
|
|
|
|
foreach ($base as $provider) {
|
|
|
|
if (get_class($provider) == $this->providerClass) {
|
|
|
|
$found = $provider;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($found) {
|
|
|
|
$this->provider = id(clone $found)->attachProviderConfig($this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $this->provider;
|
|
|
|
}
|
|
|
|
|
2013-06-17 10:48:41 -07:00
|
|
|
|
Transactions - deploy buildTransactionTimeline against a few more applications
Summary:
Ref T4712. Thus far, it seems that most "non-standard" things can be done pretty easily in the controller. Aside from deploying, this diff had to fix a few bugs / missing implementations of stuff.
(Notably, PhabricatorAuthProviderConfig, HeraldRule, PhabricatorSlowvotePoll, and AlmanacNetwork needed to implement PhabricatorApplicationTransactionInterface, PhabricatorAuthAuthProviderPHIDType had to be added, and a rendering bug in transactions of type PhabricatorOAuth2AuthProvider had to be fixed.)
Test Plan: Almanac - looked at binding, device, network, and service view controllers and verified timeline displayed properly. Herald - looked at a rule and verified timeline. Slowvote - looked at a vote and verified timeline. Auth - looked at an auth provider (Facebook) and verified proper display of transactions within timeline.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T4712
Differential Revision: https://secure.phabricator.com/D10921
2014-12-02 14:33:59 -08:00
|
|
|
/* -( PhabricatorApplicationTransactionInterface )------------------------- */
|
|
|
|
|
|
|
|
|
|
|
|
public function getApplicationTransactionEditor() {
|
|
|
|
return new PhabricatorAuthProviderConfigEditor();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getApplicationTransactionObject() {
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getApplicationTransactionTemplate() {
|
|
|
|
return new PhabricatorAuthProviderConfigTransaction();
|
|
|
|
}
|
|
|
|
|
2014-12-04 13:58:52 -08:00
|
|
|
public function willRenderTimeline(
|
|
|
|
PhabricatorApplicationTransactionView $timeline,
|
|
|
|
AphrontRequest $request) {
|
|
|
|
|
|
|
|
return $timeline;
|
|
|
|
}
|
|
|
|
|
Transactions - deploy buildTransactionTimeline against a few more applications
Summary:
Ref T4712. Thus far, it seems that most "non-standard" things can be done pretty easily in the controller. Aside from deploying, this diff had to fix a few bugs / missing implementations of stuff.
(Notably, PhabricatorAuthProviderConfig, HeraldRule, PhabricatorSlowvotePoll, and AlmanacNetwork needed to implement PhabricatorApplicationTransactionInterface, PhabricatorAuthAuthProviderPHIDType had to be added, and a rendering bug in transactions of type PhabricatorOAuth2AuthProvider had to be fixed.)
Test Plan: Almanac - looked at binding, device, network, and service view controllers and verified timeline displayed properly. Herald - looked at a rule and verified timeline. Slowvote - looked at a vote and verified timeline. Auth - looked at an auth provider (Facebook) and verified proper display of transactions within timeline.
Reviewers: epriestley
Reviewed By: epriestley
Subscribers: Korvin, epriestley
Maniphest Tasks: T4712
Differential Revision: https://secure.phabricator.com/D10921
2014-12-02 14:33:59 -08:00
|
|
|
|
2013-06-17 10:49:18 -07:00
|
|
|
/* -( PhabricatorPolicyInterface )----------------------------------------- */
|
|
|
|
|
|
|
|
|
|
|
|
public function getCapabilities() {
|
|
|
|
return array(
|
|
|
|
PhabricatorPolicyCapability::CAN_VIEW,
|
|
|
|
PhabricatorPolicyCapability::CAN_EDIT,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getPolicy($capability) {
|
|
|
|
switch ($capability) {
|
|
|
|
case PhabricatorPolicyCapability::CAN_VIEW:
|
|
|
|
return PhabricatorPolicies::POLICY_USER;
|
|
|
|
case PhabricatorPolicyCapability::CAN_EDIT:
|
|
|
|
return PhabricatorPolicies::POLICY_ADMIN;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-06-17 10:48:41 -07:00
|
|
|
}
|