Path: blob/master/src/applications/maniphest/policy/ManiphestTaskPolicyCodex.php
12256 views
<?php12final class ManiphestTaskPolicyCodex3extends PhabricatorPolicyCodex {45public function getPolicyShortName() {6$object = $this->getObject();78if ($object->areEditsLocked()) {9return pht('Edits Locked');10}1112return null;13}1415public function getPolicyIcon() {16$object = $this->getObject();1718if ($object->areEditsLocked()) {19return 'fa-lock';20}2122return null;23}2425public function getPolicyTagClasses() {26$object = $this->getObject();27$classes = array();2829if ($object->areEditsLocked()) {30$classes[] = 'policy-adjusted-locked';31}3233return $classes;34}3536public function getPolicySpecialRuleDescriptions() {37$object = $this->getObject();3839$rules = array();4041$rules[] = $this->newRule()42->setCapabilities(43array(44PhabricatorPolicyCapability::CAN_VIEW,45PhabricatorPolicyCapability::CAN_EDIT,46))47->setDescription(48pht('The owner of a task can always view and edit it.'));4950$rules[] = $this->newRule()51->setCapabilities(52array(53PhabricatorPolicyCapability::CAN_EDIT,54))55->setIsActive($object->areEditsLocked())56->setDescription(57pht(58'Tasks with edits locked may only be edited by their owner.'));5960return $rules;61}6263public function getPolicyForEdit($capability) {6465// When a task has its edits locked, the effective edit policy is locked66// to "No One". However, the task owner may still bypass the lock and edit67// the task. When they do, we want the control in the UI to have the68// correct value. Return the real value stored on the object.6970switch ($capability) {71case PhabricatorPolicyCapability::CAN_EDIT:72return $this->getObject()->getEditPolicy();73}7475return parent::getPolicyForEdit($capability);76}7778}798081