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,
|
|
|
|
),
|
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(
|
2013-07-30 15:47:07 +02:00
|
|
|
DivinerPHIDTypeBook::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) {
|
|
|
|
$groups = $this->getConfig('groups');
|
|
|
|
$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) {
|
|
|
|
return $this->viewPolicy;
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
}
|