2013-06-20 20:19:11 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorAuthProviderOAuthAsana
|
|
|
|
extends PhabricatorAuthProviderOAuth {
|
|
|
|
|
|
|
|
public function getProviderName() {
|
|
|
|
return pht('Asana');
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getConfigurationHelp() {
|
|
|
|
$app_uri = PhabricatorEnv::getProductionURI('/');
|
2014-01-23 23:03:44 +01:00
|
|
|
$login_uri = PhabricatorEnv::getURI($this->getLoginURI());
|
2013-06-20 20:19:11 +02:00
|
|
|
|
|
|
|
return pht(
|
2013-06-24 19:00:09 +02:00
|
|
|
"To configure Asana OAuth, create a new application here:".
|
2013-06-20 20:19:11 +02:00
|
|
|
"\n\n".
|
2013-06-24 19:00:09 +02:00
|
|
|
"https://app.asana.com/-/account_api".
|
|
|
|
"\n\n".
|
|
|
|
"When creating your application, use these settings:".
|
2013-06-20 20:19:11 +02:00
|
|
|
"\n\n".
|
|
|
|
" - **App URL:** Set this to: `%s`\n".
|
|
|
|
" - **Redirect URL:** Set this to: `%s`".
|
|
|
|
"\n\n".
|
|
|
|
"After completing configuration, copy the **Client ID** and ".
|
|
|
|
"**Client Secret** to the fields above.",
|
|
|
|
$app_uri,
|
|
|
|
$login_uri);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function newOAuthAdapter() {
|
|
|
|
return new PhutilAuthAdapterOAuthAsana();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function getLoginIcon() {
|
|
|
|
return 'Asana';
|
|
|
|
}
|
|
|
|
|
2013-06-25 00:54:54 +02:00
|
|
|
public static function getAsanaProvider() {
|
|
|
|
$providers = self::getAllEnabledProviders();
|
|
|
|
|
|
|
|
foreach ($providers as $provider) {
|
|
|
|
if ($provider instanceof PhabricatorAuthProviderOAuthAsana) {
|
|
|
|
return $provider;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2013-06-20 20:19:11 +02:00
|
|
|
}
|