Changeset View
Changeset View
Standalone View
Standalone View
src/applications/files/controller/PhabricatorFileEditController.php
<?php | <?php | ||||
final class PhabricatorFileEditController extends PhabricatorFileController { | final class PhabricatorFileEditController extends PhabricatorFileController { | ||||
private $id; | public function handleRequest(AphrontRequest $request) { | ||||
$viewer = $request->getViewer(); | |||||
public function willProcessRequest(array $data) { | $id = $request->getURIData('id'); | ||||
$this->id = $data['id']; | |||||
} | |||||
public function processRequest() { | |||||
$request = $this->getRequest(); | |||||
$viewer = $request->getUser(); | |||||
$file = id(new PhabricatorFileQuery()) | $file = id(new PhabricatorFileQuery()) | ||||
->setViewer($viewer) | ->setViewer($viewer) | ||||
->withIDs(array($this->id)) | ->withIDs(array($id)) | ||||
->requireCapabilities( | ->requireCapabilities( | ||||
array( | array( | ||||
PhabricatorPolicyCapability::CAN_VIEW, | PhabricatorPolicyCapability::CAN_VIEW, | ||||
PhabricatorPolicyCapability::CAN_EDIT, | PhabricatorPolicyCapability::CAN_EDIT, | ||||
)) | )) | ||||
->executeOne(); | ->executeOne(); | ||||
if (!$file) { | if (!$file) { | ||||
return new Aphront404Response(); | return new Aphront404Response(); | ||||
▲ Show 20 Lines • Show All 87 Lines • Show Last 20 Lines |