2013-02-15 16:47:14 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class PhabricatorToken extends PhabricatorTokenDAO
|
|
|
|
implements PhabricatorPolicyInterface {
|
|
|
|
|
|
|
|
protected $phid;
|
|
|
|
protected $name;
|
|
|
|
protected $filePHID;
|
|
|
|
|
2015-01-13 20:47:05 +01:00
|
|
|
protected function getConfiguration() {
|
2013-02-15 16:47:14 +01:00
|
|
|
return array(
|
|
|
|
self::CONFIG_AUX_PHID => true,
|
2014-10-01 16:40:36 +02:00
|
|
|
self::CONFIG_NO_TABLE => true,
|
2013-02-15 16:47:14 +01:00
|
|
|
) + parent::getConfiguration();
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getCapabilities() {
|
|
|
|
return array(
|
|
|
|
PhabricatorPolicyCapability::CAN_VIEW,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getPolicy($capability) {
|
2014-04-22 00:33:07 +02:00
|
|
|
return PhabricatorPolicies::getMostOpenPolicy();
|
2013-02-15 16:47:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-09-27 17:43:41 +02:00
|
|
|
public function describeAutomaticCapability($capability) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2013-02-15 16:47:14 +01:00
|
|
|
public function renderIcon() {
|
|
|
|
// TODO: Maybe move to a View class?
|
|
|
|
|
|
|
|
require_celerity_resource('sprite-tokens-css');
|
|
|
|
require_celerity_resource('tokens-css');
|
|
|
|
|
|
|
|
$sprite = substr($this->getPHID(), 10);
|
|
|
|
|
2013-04-20 02:44:20 +02:00
|
|
|
return id(new PHUIIconView())
|
|
|
|
->setSpriteSheet(PHUIIconView::SPRITE_TOKENS)
|
|
|
|
->setSpriteIcon($sprite);
|
|
|
|
|
2013-02-15 16:47:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|