mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-15 03:12:41 +01:00
fcba0c74d9
Summary: Ref T3599 Go through everything, grep a bit, replace some bits. Test Plan: Navigate around a bit Reviewers: epriestley Reviewed By: epriestley CC: Korvin, aran Maniphest Tasks: T3599 Differential Revision: https://secure.phabricator.com/D6871
51 lines
1.2 KiB
PHP
51 lines
1.2 KiB
PHP
<?php
|
|
|
|
final class PhabricatorTokenGiven extends PhabricatorTokenDAO
|
|
implements PhabricatorPolicyInterface {
|
|
|
|
protected $authorPHID;
|
|
protected $objectPHID;
|
|
protected $tokenPHID;
|
|
|
|
private $object = self::ATTACHABLE;
|
|
|
|
public function attachObject(PhabricatorTokenReceiverInterface $object) {
|
|
$this->object = $object;
|
|
return $this;
|
|
}
|
|
|
|
public function getObject() {
|
|
return $this->assertAttached($this->object);
|
|
}
|
|
|
|
public function getCapabilities() {
|
|
return array(
|
|
PhabricatorPolicyCapability::CAN_VIEW,
|
|
PhabricatorPolicyCapability::CAN_EDIT,
|
|
);
|
|
}
|
|
|
|
public function getPolicy($capability) {
|
|
switch ($capability) {
|
|
case PhabricatorPolicyCapability::CAN_VIEW:
|
|
return $this->getObject()->getPolicy($capability);
|
|
default:
|
|
return PhabricatorPolicies::POLICY_NOONE;
|
|
}
|
|
}
|
|
|
|
public function hasAutomaticCapability($capability, PhabricatorUser $user) {
|
|
switch ($capability) {
|
|
case PhabricatorPolicyCapability::CAN_VIEW:
|
|
return $this->getObject()->hasAutomaticCapability(
|
|
$capability,
|
|
$user);
|
|
default:
|
|
if ($user->getPHID() == $this->authorPHID) {
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
}
|
|
|
|
}
|