Differential D20106 Diff 48030 src/applications/settings/panel/PhabricatorExternalAccountsSettingsPanel.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/settings/panel/PhabricatorExternalAccountsSettingsPanel.php
| Show All 35 Lines | $accounts = id(new PhabricatorExternalAccountQuery()) | ||||
| ->execute(); | ->execute(); | ||||
| $linked_head = pht('Linked Accounts and Authentication'); | $linked_head = pht('Linked Accounts and Authentication'); | ||||
| $linked = id(new PHUIObjectItemListView()) | $linked = id(new PHUIObjectItemListView()) | ||||
| ->setUser($viewer) | ->setUser($viewer) | ||||
| ->setNoDataString(pht('You have no linked accounts.')); | ->setNoDataString(pht('You have no linked accounts.')); | ||||
| $login_accounts = 0; | |||||
| foreach ($accounts as $account) { | |||||
| if ($account->isUsableForLogin()) { | |||||
| $login_accounts++; | |||||
| } | |||||
| } | |||||
| foreach ($accounts as $account) { | foreach ($accounts as $account) { | ||||
| $item = new PHUIObjectItemView(); | $item = new PHUIObjectItemView(); | ||||
| $provider = idx($providers, $account->getProviderKey()); | $provider = idx($providers, $account->getProviderKey()); | ||||
| if ($provider) { | if ($provider) { | ||||
| $item->setHeader($provider->getProviderName()); | $item->setHeader($provider->getProviderName()); | ||||
| $can_unlink = $provider->shouldAllowAccountUnlink(); | $can_unlink = $provider->shouldAllowAccountUnlink(); | ||||
| if (!$can_unlink) { | if (!$can_unlink) { | ||||
| $item->addAttribute(pht('Permanently Linked')); | $item->addAttribute(pht('Permanently Linked')); | ||||
| } | } | ||||
| } else { | } else { | ||||
| $item->setHeader( | $item->setHeader( | ||||
| pht('Unknown Account ("%s")', $account->getProviderKey())); | pht('Unknown Account ("%s")', $account->getProviderKey())); | ||||
| $can_unlink = true; | $can_unlink = true; | ||||
| } | } | ||||
| $can_login = $account->isUsableForLogin(); | $can_login = $account->isUsableForLogin(); | ||||
| if (!$can_login) { | if (!$can_login) { | ||||
| $item->addAttribute( | $item->addAttribute( | ||||
| pht( | pht( | ||||
| 'Disabled (an administrator has disabled login for this '. | 'Disabled (an administrator has disabled login for this '. | ||||
| 'account provider).')); | 'account provider).')); | ||||
| } | } | ||||
| $can_unlink = $can_unlink && (!$can_login || ($login_accounts > 1)); | |||||
| $can_refresh = $provider && $provider->shouldAllowAccountRefresh(); | $can_refresh = $provider && $provider->shouldAllowAccountRefresh(); | ||||
| if ($can_refresh) { | if ($can_refresh) { | ||||
| $item->addAction( | $item->addAction( | ||||
| id(new PHUIListItemView()) | id(new PHUIListItemView()) | ||||
| ->setIcon('fa-refresh') | ->setIcon('fa-refresh') | ||||
| ->setHref('/auth/refresh/'.$account->getProviderKey().'/')); | ->setHref('/auth/refresh/'.$account->getProviderKey().'/')); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 70 Lines • Show Last 20 Lines | |||||