Changeset View
Changeset View
Standalone View
Standalone View
src/applications/drydock/storage/DrydockResource.php
<?php | <?php | ||||
final class DrydockResource extends DrydockDAO | final class DrydockResource extends DrydockDAO | ||||
implements PhabricatorPolicyInterface { | implements | ||||
PhabricatorPolicyInterface, | |||||
PhabricatorConduitResultInterface { | |||||
protected $id; | protected $id; | ||||
protected $phid; | protected $phid; | ||||
protected $blueprintPHID; | protected $blueprintPHID; | ||||
protected $status; | protected $status; | ||||
protected $until; | protected $until; | ||||
protected $type; | protected $type; | ||||
protected $attributes = array(); | protected $attributes = array(); | ||||
▲ Show 20 Lines • Show All 322 Lines • ▼ Show 20 Lines | public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { | ||||
return $this->getBlueprint()->hasAutomaticCapability( | return $this->getBlueprint()->hasAutomaticCapability( | ||||
$capability, | $capability, | ||||
$viewer); | $viewer); | ||||
} | } | ||||
public function describeAutomaticCapability($capability) { | public function describeAutomaticCapability($capability) { | ||||
return pht('Resources inherit the policies of their blueprints.'); | return pht('Resources inherit the policies of their blueprints.'); | ||||
} | } | ||||
/* -( PhabricatorConduitResultInterface )---------------------------------- */ | |||||
public function getFieldSpecificationsForConduit() { | |||||
return array( | |||||
id(new PhabricatorConduitSearchFieldSpecification()) | |||||
->setKey('blueprintPHID') | |||||
->setType('phid') | |||||
->setDescription(pht('The blueprint which generated this resource.')), | |||||
id(new PhabricatorConduitSearchFieldSpecification()) | |||||
->setKey('status') | |||||
->setType('map<string, wild>') | |||||
->setDescription(pht('Information about resource status.')), | |||||
); | |||||
} | |||||
public function getFieldValuesForConduit() { | |||||
$status = $this->getStatus(); | |||||
return array( | |||||
'blueprintPHID' => $this->getBlueprintPHID(), | |||||
'status' => array( | |||||
'value' => $status, | |||||
'name' => DrydockResourceStatus::getNameForStatus($status), | |||||
), | |||||
); | |||||
} | |||||
public function getConduitSearchAttachments() { | |||||
return array(); | |||||
} | |||||
} | } |