2013-05-20 19:18:26 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
final class DivinerLiveBook extends DivinerDAO
|
|
|
|
implements PhabricatorPolicyInterface {
|
|
|
|
|
|
|
|
protected $name;
|
|
|
|
protected $viewPolicy;
|
2013-06-04 20:15:34 +02:00
|
|
|
protected $configurationData = array();
|
2013-05-20 19:18:26 +02:00
|
|
|
|
|
|
|
public function getConfiguration() {
|
|
|
|
return array(
|
|
|
|
self::CONFIG_AUX_PHID => true,
|
2013-06-04 20:15:34 +02:00
|
|
|
self::CONFIG_SERIALIZATION => array(
|
|
|
|
'configurationData' => self::SERIALIZATION_JSON,
|
|
|
|
),
|
2014-10-01 16:53:12 +02:00
|
|
|
self::CONFIG_COLUMN_SCHEMA => array(
|
|
|
|
'name' => 'text64',
|
|
|
|
),
|
|
|
|
self::CONFIG_KEY_SCHEMA => array(
|
|
|
|
'key_phid' => null,
|
|
|
|
'phid' => array(
|
|
|
|
'columns' => array('phid'),
|
|
|
|
'unique' => true,
|
|
|
|
),
|
|
|
|
'name' => array(
|
|
|
|
'columns' => array('name'),
|
|
|
|
'unique' => true,
|
|
|
|
),
|
|
|
|
),
|
2013-05-20 19:18:26 +02:00
|
|
|
) + parent::getConfiguration();
|
|
|
|
}
|
|
|
|
|
2013-06-04 20:15:34 +02:00
|
|
|
public function getConfig($key, $default = null) {
|
|
|
|
return idx($this->configurationData, $key, $default);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setConfig($key, $value) {
|
|
|
|
$this->configurationData[$key] = $value;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2013-05-20 19:18:26 +02:00
|
|
|
public function generatePHID() {
|
|
|
|
return PhabricatorPHID::generateNewPHID(
|
2014-07-24 00:05:46 +02:00
|
|
|
DivinerBookPHIDType::TYPECONST);
|
2013-05-20 19:18:26 +02:00
|
|
|
}
|
|
|
|
|
2013-06-04 20:15:34 +02:00
|
|
|
public function getTitle() {
|
|
|
|
return $this->getConfig('title', $this->getName());
|
|
|
|
}
|
|
|
|
|
2013-06-06 17:36:51 +02:00
|
|
|
public function getShortTitle() {
|
|
|
|
return $this->getConfig('short', $this->getTitle());
|
|
|
|
}
|
|
|
|
|
2014-03-05 21:08:01 +01:00
|
|
|
public function getPreface() {
|
|
|
|
return $this->getConfig('preface');
|
|
|
|
}
|
|
|
|
|
2013-06-06 17:36:51 +02:00
|
|
|
public function getGroupName($group) {
|
2014-12-17 04:34:55 +01:00
|
|
|
$groups = $this->getConfig('groups', array());
|
2013-06-06 17:36:51 +02:00
|
|
|
$spec = idx($groups, $group, array());
|
2013-07-28 22:07:30 +02:00
|
|
|
return idx($spec, 'name', $group);
|
2013-06-06 17:36:51 +02:00
|
|
|
}
|
|
|
|
|
2013-05-20 19:18:26 +02:00
|
|
|
/* -( PhabricatorPolicyInterface )----------------------------------------- */
|
|
|
|
|
|
|
|
public function getCapabilities() {
|
|
|
|
return array(
|
|
|
|
PhabricatorPolicyCapability::CAN_VIEW,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getPolicy($capability) {
|
2014-03-06 02:19:40 +01:00
|
|
|
return PhabricatorPolicies::getMostOpenPolicy();
|
2013-05-20 19:18:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-09-27 17:43:41 +02:00
|
|
|
public function describeAutomaticCapability($capability) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2013-05-20 19:18:26 +02:00
|
|
|
}
|