Changeset View
Changeset View
Standalone View
Standalone View
src/applications/search/engine/PhabricatorProfileMenuEngine.php
Show First 20 Lines • Show All 491 Lines • ▼ Show 20 Lines | abstract class PhabricatorProfileMenuEngine extends Phobject { | ||||
public function getConfigureURI() { | public function getConfigureURI() { | ||||
return $this->getItemURI('configure/'); | return $this->getItemURI('configure/'); | ||||
} | } | ||||
private function buildItemReorderContent(array $items) { | private function buildItemReorderContent(array $items) { | ||||
$viewer = $this->getViewer(); | $viewer = $this->getViewer(); | ||||
$object = $this->getProfileObject(); | $object = $this->getProfileObject(); | ||||
// If you're reordering global items, you need to be able to edit the | |||||
// object the menu appears on. If you're reordering custom items, you only | |||||
// need to be able to edit the custom object. Currently, the custom object | |||||
// is always the viewing user's own user object. | |||||
$custom_phid = $this->getCustomPHID(); | |||||
if (!$custom_phid) { | |||||
PhabricatorPolicyFilter::requireCapability( | PhabricatorPolicyFilter::requireCapability( | ||||
$viewer, | $viewer, | ||||
$object, | $object, | ||||
PhabricatorPolicyCapability::CAN_EDIT); | PhabricatorPolicyCapability::CAN_EDIT); | ||||
} else { | |||||
$policy_object = id(new PhabricatorObjectQuery()) | |||||
->setViewer($viewer) | |||||
->withPHIDs(array($custom_phid)) | |||||
->executeOne(); | |||||
if (!$policy_object) { | |||||
throw new Exception( | |||||
pht( | |||||
'Failed to load custom PHID "%s"!', | |||||
$custom_phid)); | |||||
} | |||||
PhabricatorPolicyFilter::requireCapability( | |||||
$viewer, | |||||
$policy_object, | |||||
PhabricatorPolicyCapability::CAN_EDIT); | |||||
} | |||||
$controller = $this->getController(); | $controller = $this->getController(); | ||||
$request = $controller->getRequest(); | $request = $controller->getRequest(); | ||||
$request->validateCSRF(); | $request->validateCSRF(); | ||||
$order = $request->getStrList('order'); | $order = $request->getStrList('order'); | ||||
▲ Show 20 Lines • Show All 579 Lines • Show Last 20 Lines |