Differential D15329 Diff 36972 src/applications/almanac/controller/AlmanacPropertyEditController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/almanac/controller/AlmanacPropertyEditController.php
<?php | <?php | ||||
final class AlmanacPropertyEditController | final class AlmanacPropertyEditController | ||||
extends AlmanacDeviceController { | extends AlmanacPropertyController { | ||||
public function handleRequest(AphrontRequest $request) { | public function handleRequest(AphrontRequest $request) { | ||||
$viewer = $request->getViewer(); | $viewer = $request->getViewer(); | ||||
$object = id(new PhabricatorObjectQuery()) | $response = $this->loadPropertyObject(); | ||||
->setViewer($viewer) | if ($response) { | ||||
->withPHIDs(array($request->getStr('objectPHID'))) | return $response; | ||||
->requireCapabilities( | |||||
array( | |||||
PhabricatorPolicyCapability::CAN_VIEW, | |||||
PhabricatorPolicyCapability::CAN_EDIT, | |||||
)) | |||||
->executeOne(); | |||||
if (!$object) { | |||||
return new Aphront404Response(); | |||||
} | } | ||||
if (!($object instanceof AlmanacPropertyInterface)) { | $object = $this->getPropertyObject(); | ||||
return new Aphront404Response(); | |||||
} | |||||
$cancel_uri = $object->getURI(); | $cancel_uri = $object->getURI(); | ||||
$property_key = $request->getStr('key'); | $property_key = $request->getStr('key'); | ||||
if (!strlen($property_key)) { | if (!strlen($property_key)) { | ||||
return $this->buildPropertyKeyResponse($cancel_uri, null); | return $this->buildPropertyKeyResponse($cancel_uri, null); | ||||
} else { | } else { | ||||
$error = null; | $error = null; | ||||
▲ Show 20 Lines • Show All 73 Lines • Show Last 20 Lines |