3 final class PhabricatorTokensSettingsPanel
extends PhabricatorSettingsPanel
{
5 public function getPanelKey() {
9 public function getPanelName() {
10 return pht('Temporary Tokens');
13 public function getPanelMenuIcon() {
17 public function getPanelGroupKey() {
18 return PhabricatorSettingsLogsPanelGroup
::PANELGROUPKEY
;
21 public function processRequest(AphrontRequest
$request) {
22 $viewer = $request->getUser();
24 $tokens = id(new PhabricatorAuthTemporaryTokenQuery())
26 ->withTokenResources(array($viewer->getPHID()))
30 foreach ($tokens as $token) {
32 if ($token->isRevocable()) {
33 $button = javelin_tag(
36 'href' => '/auth/token/revoke/'.$token->getID().'/',
37 'class' => 'small button button-grey',
38 'sigil' => 'workflow',
42 $button = javelin_tag(
45 'class' => 'small button button-grey disabled',
50 if ($token->getTokenExpires() >= time()) {
51 $expiry = phabricator_datetime($token->getTokenExpires(), $viewer);
53 $expiry = pht('Expired');
57 $token->getTokenReadableTypeName(),
63 $table = new AphrontTableView($rows);
64 $table->setNoDataString(pht("You don't have any active tokens."));
71 $table->setColumnClasses(
78 $button = id(new PHUIButtonView())
80 ->setIcon('fa-warning')
81 ->setText(pht('Revoke All'))
82 ->setHref('/auth/token/revoke/all/')
84 ->setColor(PHUIButtonView
::RED
);
86 return $this->newBox(pht('Temporary Tokens'), $table, array($button));