Moved provisioning change function into controller from helper

This commit is contained in:
Duncan Sommerville 2015-03-19 17:32:02 -04:00
parent bd72252e9e
commit 2ec2403cce
2 changed files with 35 additions and 26 deletions

View file

@ -18,6 +18,40 @@ class ProvisioningController extends Zend_Controller_Action
*
*/
/**
* Endpoint to change Airtime preferences remotely.
* Mainly for use with the dashboard right now.
*/
public function changeAction() {
$this->view->layout()->disableLayout();
$this->_helper->viewRenderer->setNoRender(true);
if (!RestAuth::verifyAuth(true, true, $this)) {
return;
}
try {
// This is hacky and should be genericized
if ($_POST['station_name']) {
Application_Model_Preference::SetStationName($_POST['station_name']);
}
if ($_POST['station_name']) {
Application_Model_Preference::SetStationDescription($_POST['station_name']);
}
} catch (Exception $e) {
$this->getResponse()
->setHttpResponseCode(400)
->appendBody("ERROR: " . $e->getMessage());
Logging::error($e->getMessage());
echo $e->getMessage() . PHP_EOL;
return;
}
$this->getResponse()
->setHttpResponseCode(200)
->appendBody("OK");
}
/**
* Delete the Airtime Pro station's files from Amazon S3
*/