Changeset View
Changeset View
Standalone View
Standalone View
src/applications/phame/storage/PhamePost.php
| Show First 20 Lines • Show All 194 Lines • ▼ Show 20 Lines | /* -( PhabricatorPolicyInterface Implementation )-------------------------- */ | ||||
| public function getCapabilities() { | public function getCapabilities() { | ||||
| return array( | return array( | ||||
| PhabricatorPolicyCapability::CAN_VIEW, | PhabricatorPolicyCapability::CAN_VIEW, | ||||
| PhabricatorPolicyCapability::CAN_EDIT, | PhabricatorPolicyCapability::CAN_EDIT, | ||||
| ); | ); | ||||
| } | } | ||||
| public function getPolicy($capability) { | public function getPolicy($capability) { | ||||
| // Draft posts are visible only to the author. Published posts are visible | // Draft and archived posts are visible only to the author and other | ||||
| // to whoever the blog is visible to. | // users who can edit the blog. Published posts are visible to whoever | ||||
| // the blog is visible to. | |||||
| switch ($capability) { | switch ($capability) { | ||||
| case PhabricatorPolicyCapability::CAN_VIEW: | case PhabricatorPolicyCapability::CAN_VIEW: | ||||
| if (!$this->isDraft() && !$this->isArchived() && $this->getBlog()) { | if (!$this->isDraft() && !$this->isArchived() && $this->getBlog()) { | ||||
| return $this->getBlog()->getViewPolicy(); | return $this->getBlog()->getViewPolicy(); | ||||
| } else if ($this->getBlog()) { | } else if ($this->getBlog()) { | ||||
| return $this->getBlog()->getEditPolicy(); | return $this->getBlog()->getEditPolicy(); | ||||
| } else { | } else { | ||||
| ▲ Show 20 Lines • Show All 177 Lines • Show Last 20 Lines | |||||