Differential D14584 Diff 35308 src/applications/transactions/controller/PhabricatorEditEngineController.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/transactions/controller/PhabricatorEditEngineController.php
Show All 28 Lines | if ($engine_key !== null) { | ||||
$engine->getEngineName(), | $engine->getEngineName(), | ||||
"/transactions/editengine/{$engine_key}/"); | "/transactions/editengine/{$engine_key}/"); | ||||
} | } | ||||
} | } | ||||
return $crumbs; | return $crumbs; | ||||
} | } | ||||
protected function loadConfigForEdit() { | |||||
$request = $this->getRequest(); | |||||
$viewer = $this->getViewer(); | |||||
$engine_key = $request->getURIData('engineKey'); | |||||
$this->setEngineKey($engine_key); | |||||
$key = $request->getURIData('key'); | |||||
$config = id(new PhabricatorEditEngineConfigurationQuery()) | |||||
->setViewer($viewer) | |||||
->withEngineKeys(array($engine_key)) | |||||
->withIdentifiers(array($key)) | |||||
->requireCapabilities( | |||||
array( | |||||
PhabricatorPolicyCapability::CAN_VIEW, | |||||
PhabricatorPolicyCapability::CAN_EDIT, | |||||
)) | |||||
->executeOne(); | |||||
if ($config) { | |||||
$engine = $config->getEngine(); | |||||
// TODO: When we're editing the meta-engine, we need to set the engine | |||||
// itself as its own target. This is hacky and it would be nice to find | |||||
// a cleaner approach later. | |||||
if ($engine instanceof PhabricatorEditEngineConfigurationEditEngine) { | |||||
$engine->setTargetEngine($engine); | |||||
} | |||||
} | |||||
return $config; | |||||
} | |||||
} | } |