forked from phacility/phabricator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPhabricatorToken.php
45 lines (33 loc) · 1006 Bytes
/
PhabricatorToken.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
final class PhabricatorToken extends PhabricatorTokenDAO
implements PhabricatorPolicyInterface {
protected $phid;
protected $name;
protected $filePHID;
protected function getConfiguration() {
return array(
self::CONFIG_AUX_PHID => true,
self::CONFIG_NO_TABLE => true,
) + parent::getConfiguration();
}
public function getCapabilities() {
return array(
PhabricatorPolicyCapability::CAN_VIEW,
);
}
public function getPolicy($capability) {
return PhabricatorPolicies::getMostOpenPolicy();
}
public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
return false;
}
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);
return id(new PHUIIconView())
->setSpriteSheet(PHUIIconView::SPRITE_TOKENS)
->setSpriteIcon($sprite);
}
}