Changeset View
Changeset View
Standalone View
Standalone View
src/applications/project/storage/PhabricatorProject.php
| Show First 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | public function getCapabilities() { | ||||
| return array( | return array( | ||||
| PhabricatorPolicyCapability::CAN_VIEW, | PhabricatorPolicyCapability::CAN_VIEW, | ||||
| PhabricatorPolicyCapability::CAN_EDIT, | PhabricatorPolicyCapability::CAN_EDIT, | ||||
| PhabricatorPolicyCapability::CAN_JOIN, | PhabricatorPolicyCapability::CAN_JOIN, | ||||
| ); | ); | ||||
| } | } | ||||
| public function getPolicy($capability) { | public function getPolicy($capability) { | ||||
| if ($this->isMilestone()) { | |||||
| return $this->getParentProject()->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: | case PhabricatorPolicyCapability::CAN_JOIN: | ||||
| return $this->getJoinPolicy(); | return $this->getJoinPolicy(); | ||||
| } | } | ||||
| } | } | ||||
| public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { | public function hasAutomaticCapability($capability, PhabricatorUser $viewer) { | ||||
| if ($this->isMilestone()) { | |||||
| return $this->getParentProject()->hasAutomaticCapability( | |||||
| $capability, | |||||
| $viewer); | |||||
| } | |||||
| $can_edit = PhabricatorPolicyCapability::CAN_EDIT; | $can_edit = PhabricatorPolicyCapability::CAN_EDIT; | ||||
| switch ($capability) { | switch ($capability) { | ||||
| case PhabricatorPolicyCapability::CAN_VIEW: | case PhabricatorPolicyCapability::CAN_VIEW: | ||||
| if ($this->isUserMember($viewer->getPHID())) { | if ($this->isUserMember($viewer->getPHID())) { | ||||
| // Project members can always view a project. | // Project members can always view a project. | ||||
| return true; | return true; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 322 Lines • ▼ Show 20 Lines | public function getAncestorProjects() { | ||||
| while ($cursor) { | while ($cursor) { | ||||
| $ancestors[] = $cursor; | $ancestors[] = $cursor; | ||||
| $cursor = $cursor->getParentProject(); | $cursor = $cursor->getParentProject(); | ||||
| } | } | ||||
| return $ancestors; | return $ancestors; | ||||
| } | } | ||||
| public function supportsEditMembers() { | |||||
| if ($this->isMilestone()) { | |||||
| return false; | |||||
| } | |||||
| if ($this->getHasSubprojects()) { | |||||
| return false; | |||||
| } | |||||
| return true; | |||||
| } | |||||
| public function supportsMilestones() { | |||||
| if ($this->isMilestone()) { | |||||
| return false; | |||||
| } | |||||
| return true; | |||||
| } | |||||
| public function supportsSubprojects() { | |||||
| if ($this->isMilestone()) { | |||||
| return false; | |||||
| } | |||||
| return true; | |||||
| } | |||||
| /* -( PhabricatorSubscribableInterface )----------------------------------- */ | /* -( PhabricatorSubscribableInterface )----------------------------------- */ | ||||
| public function isAutomaticallySubscribed($phid) { | public function isAutomaticallySubscribed($phid) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 115 Lines • Show Last 20 Lines | |||||