Changeset View
Changeset View
Standalone View
Standalone View
src/applications/conpherence/storage/ConpherenceThread.php
Show All 10 Lines | final class ConpherenceThread extends ConpherenceDAO | ||||
protected $title; | protected $title; | ||||
protected $topic; | protected $topic; | ||||
protected $profileImagePHID; | protected $profileImagePHID; | ||||
protected $messageCount; | protected $messageCount; | ||||
protected $recentParticipantPHIDs = array(); | protected $recentParticipantPHIDs = array(); | ||||
protected $mailKey; | protected $mailKey; | ||||
protected $viewPolicy; | protected $viewPolicy; | ||||
protected $editPolicy; | protected $editPolicy; | ||||
protected $joinPolicy; | protected $joinPolicy; | ||||
private $participants = self::ATTACHABLE; | private $participants = self::ATTACHABLE; | ||||
private $transactions = self::ATTACHABLE; | private $transactions = self::ATTACHABLE; | ||||
private $profileImageFile = self::ATTACHABLE; | private $profileImageFile = self::ATTACHABLE; | ||||
private $handles = self::ATTACHABLE; | private $handles = self::ATTACHABLE; | ||||
public static function initializeNewRoom(PhabricatorUser $sender) { | public static function initializeNewRoom(PhabricatorUser $sender) { | ||||
$default_policy = id(new ConpherenceThreadMembersPolicyRule()) | $default_policy = id(new ConpherenceThreadMembersPolicyRule()) | ||||
->getObjectPolicyFullKey(); | ->getObjectPolicyFullKey(); | ||||
return id(new ConpherenceThread()) | return id(new ConpherenceThread()) | ||||
->setMessageCount(0) | ->setMessageCount(0) | ||||
->setTitle('') | ->setTitle('') | ||||
->setTopic('') | ->setTopic('') | ||||
->attachParticipants(array()) | ->attachParticipants(array()) | ||||
->setViewPolicy($default_policy) | ->setViewPolicy($default_policy) | ||||
->setEditPolicy($default_policy) | ->setEditPolicy($default_policy) | ||||
->setJoinPolicy($default_policy); | ->setJoinPolicy(''); | ||||
epriestley: (Keep these too for now.) | |||||
} | } | ||||
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( | ||||
'recentParticipantPHIDs' => self::SERIALIZATION_JSON, | 'recentParticipantPHIDs' => self::SERIALIZATION_JSON, | ||||
), | ), | ||||
self::CONFIG_COLUMN_SCHEMA => array( | self::CONFIG_COLUMN_SCHEMA => array( | ||||
'title' => 'text255?', | 'title' => 'text255?', | ||||
'topic' => 'text255', | 'topic' => 'text255', | ||||
'messageCount' => 'uint64', | 'messageCount' => 'uint64', | ||||
'mailKey' => 'text20', | 'mailKey' => 'text20', | ||||
'joinPolicy' => 'policy', | 'joinPolicy' => 'policy', | ||||
Not Done Inline ActionsAnd this one. epriestley: And this one. | |||||
'profileImagePHID' => 'phid?', | 'profileImagePHID' => 'phid?', | ||||
), | ), | ||||
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, | ||||
), | ), | ||||
▲ Show 20 Lines • Show All 234 Lines • ▼ Show 20 Lines | |||||
/* -( PhabricatorPolicyInterface Implementation )-------------------------- */ | /* -( PhabricatorPolicyInterface Implementation )-------------------------- */ | ||||
public function getCapabilities() { | public function getCapabilities() { | ||||
return array( | return array( | ||||
PhabricatorPolicyCapability::CAN_VIEW, | PhabricatorPolicyCapability::CAN_VIEW, | ||||
PhabricatorPolicyCapability::CAN_EDIT, | PhabricatorPolicyCapability::CAN_EDIT, | ||||
PhabricatorPolicyCapability::CAN_JOIN, | |||||
); | ); | ||||
} | } | ||||
public function getPolicy($capability) { | public function getPolicy($capability) { | ||||
switch ($capability) { | 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(); | ||||
case PhabricatorPolicyCapability::CAN_JOIN: | |||||
return $this->getJoinPolicy(); | |||||
} | } | ||||
return PhabricatorPolicies::POLICY_NOONE; | return PhabricatorPolicies::POLICY_NOONE; | ||||
} | } | ||||
public function hasAutomaticCapability($capability, PhabricatorUser $user) { | public function hasAutomaticCapability($capability, PhabricatorUser $user) { | ||||
// this bad boy isn't even created yet so go nuts $user | // this bad boy isn't even created yet so go nuts $user | ||||
if (!$this->getID()) { | if (!$this->getID()) { | ||||
return true; | return true; | ||||
} | } | ||||
switch ($capability) { | switch ($capability) { | ||||
case PhabricatorPolicyCapability::CAN_EDIT: | case PhabricatorPolicyCapability::CAN_EDIT: | ||||
case PhabricatorPolicyCapability::CAN_JOIN: | |||||
return false; | return false; | ||||
} | } | ||||
$participants = $this->getParticipants(); | $participants = $this->getParticipants(); | ||||
return isset($participants[$user->getPHID()]); | return isset($participants[$user->getPHID()]); | ||||
} | } | ||||
public function describeAutomaticCapability($capability) { | public function describeAutomaticCapability($capability) { | ||||
▲ Show 20 Lines • Show All 87 Lines • Show Last 20 Lines |
(Keep these too for now.)