2012-03-27 05:54:26 +02:00
|
|
|
<?php
|
|
|
|
|
2013-12-26 21:30:17 +01:00
|
|
|
final class DrydockLog extends DrydockDAO
|
|
|
|
implements PhabricatorPolicyInterface {
|
2012-03-27 05:54:26 +02:00
|
|
|
|
|
|
|
protected $resourceID;
|
|
|
|
protected $leaseID;
|
|
|
|
protected $epoch;
|
|
|
|
protected $message;
|
|
|
|
|
2013-12-26 21:30:17 +01:00
|
|
|
private $resource = self::ATTACHABLE;
|
|
|
|
|
2012-03-27 05:54:26 +02:00
|
|
|
public function getConfiguration() {
|
|
|
|
return array(
|
|
|
|
self::CONFIG_TIMESTAMPS => false,
|
|
|
|
) + parent::getConfiguration();
|
|
|
|
}
|
|
|
|
|
2013-12-27 22:15:12 +01:00
|
|
|
public function attachResource(DrydockResource $resource = null) {
|
2013-12-26 21:30:17 +01:00
|
|
|
$this->resource = $resource;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getResource() {
|
|
|
|
return $this->assertAttached($this->resource);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* -( PhabricatorPolicyInterface )----------------------------------------- */
|
|
|
|
|
|
|
|
|
|
|
|
public function getCapabilities() {
|
|
|
|
return array(
|
|
|
|
PhabricatorPolicyCapability::CAN_VIEW,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getPolicy($capability) {
|
2013-12-27 22:15:12 +01:00
|
|
|
if (!$this->getResource()) {
|
|
|
|
return PhabricatorPolicies::getMostOpenPolicy();
|
|
|
|
}
|
2013-12-26 21:30:17 +01:00
|
|
|
return $this->getResource()->getPolicy($capability);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
|
2013-12-27 22:15:12 +01:00
|
|
|
if (!$this->getResource()) {
|
|
|
|
return false;
|
|
|
|
}
|
2013-12-26 21:30:17 +01:00
|
|
|
return $this->getResource()->hasAutomaticCapability($capability, $viewer);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function describeAutomaticCapability($capability) {
|
|
|
|
return pht('Logs inherit the policy of their resources.');
|
|
|
|
}
|
|
|
|
|
2012-03-27 05:54:26 +02:00
|
|
|
}
|