Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diviner/storage/DivinerLiveBook.php
| <?php | <?php | ||||
| final class DivinerLiveBook extends DivinerDAO | final class DivinerLiveBook extends DivinerDAO | ||||
| implements | implements | ||||
| PhabricatorPolicyInterface, | PhabricatorPolicyInterface, | ||||
| PhabricatorProjectInterface, | PhabricatorProjectInterface, | ||||
| PhabricatorDestructibleInterface, | PhabricatorDestructibleInterface, | ||||
| PhabricatorApplicationTransactionInterface { | PhabricatorApplicationTransactionInterface { | ||||
| protected $name; | protected $name; | ||||
| protected $repositoryPHID; | |||||
| protected $viewPolicy; | protected $viewPolicy; | ||||
| protected $editPolicy; | protected $editPolicy; | ||||
| protected $configurationData = array(); | protected $configurationData = array(); | ||||
| private $projectPHIDs = self::ATTACHABLE; | private $projectPHIDs = self::ATTACHABLE; | ||||
| private $repository = self::ATTACHABLE; | |||||
| protected function getConfiguration() { | protected function getConfiguration() { | ||||
| return array( | return array( | ||||
| self::CONFIG_AUX_PHID => true, | self::CONFIG_AUX_PHID => true, | ||||
| self::CONFIG_SERIALIZATION => array( | self::CONFIG_SERIALIZATION => array( | ||||
| 'configurationData' => self::SERIALIZATION_JSON, | 'configurationData' => self::SERIALIZATION_JSON, | ||||
| ), | ), | ||||
| self::CONFIG_COLUMN_SCHEMA => array( | self::CONFIG_COLUMN_SCHEMA => array( | ||||
| 'name' => 'text64', | 'name' => 'text64', | ||||
| 'repositoryPHID' => 'phid?', | |||||
| ), | ), | ||||
epriestley: I'd expect this to need a `'repositoryPHID' => 'phid?'` to avoid a `bin/storage upgrade`… | |||||
| self::CONFIG_KEY_SCHEMA => array( | self::CONFIG_KEY_SCHEMA => array( | ||||
| 'key_phid' => null, | 'key_phid' => null, | ||||
| 'phid' => array( | 'phid' => array( | ||||
| 'columns' => array('phid'), | 'columns' => array('phid'), | ||||
| 'unique' => true, | 'unique' => true, | ||||
| ), | ), | ||||
| 'name' => array( | 'name' => array( | ||||
| 'columns' => array('name'), | 'columns' => array('name'), | ||||
| Show All 29 Lines | final class DivinerLiveBook extends DivinerDAO | ||||
| } | } | ||||
| public function getGroupName($group) { | public function getGroupName($group) { | ||||
| $groups = $this->getConfig('groups', array()); | $groups = $this->getConfig('groups', array()); | ||||
| $spec = idx($groups, $group, array()); | $spec = idx($groups, $group, array()); | ||||
| return idx($spec, 'name', $group); | return idx($spec, 'name', $group); | ||||
| } | } | ||||
| public function attachRepository(PhabricatorRepository $repository = null) { | |||||
| $this->repository = $repository; | |||||
| return $this; | |||||
| } | |||||
| public function getRepository() { | |||||
| return $this->assertAttached($this->repository); | |||||
| } | |||||
| public function attachProjectPHIDs(array $project_phids) { | public function attachProjectPHIDs(array $project_phids) { | ||||
| $this->projectPHIDs = $project_phids; | $this->projectPHIDs = $project_phids; | ||||
| return $this; | return $this; | ||||
| } | } | ||||
| public function getProjectPHIDs() { | public function getProjectPHIDs() { | ||||
| return $this->assertAttached($this->projectPHIDs); | return $this->assertAttached($this->projectPHIDs); | ||||
| } | } | ||||
| Show All 14 Lines | switch ($capability) { | ||||
| case PhabricatorPolicyCapability::CAN_VIEW: | case PhabricatorPolicyCapability::CAN_VIEW: | ||||
| return $this->getViewPolicy(); | return $this->getViewPolicy(); | ||||
| case PhabricatorPolicyCapability::CAN_EDIT: | case PhabricatorPolicyCapability::CAN_EDIT: | ||||
| return $this->getEditPolicy(); | return $this->getEditPolicy(); | ||||
| } | } | ||||
| } | } | ||||
| public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { | public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { | ||||
| return false; | return false; | ||||
| } | } | ||||
Not Done Inline Actions(See discussion.) epriestley: (See discussion.) | |||||
| public function describeAutomaticCapability($capability) { | public function describeAutomaticCapability($capability) { | ||||
| return null; | return null; | ||||
| } | } | ||||
| /* -( PhabricatorDestructibleInterface )----------------------------------- */ | /* -( PhabricatorDestructibleInterface )----------------------------------- */ | ||||
| ▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines | |||||
I'd expect this to need a 'repositoryPHID' => 'phid?' to avoid a bin/storage upgrade warning about column nullability.