Added provisioning code for change requests

This commit is contained in:
Duncan Sommerville 2015-03-03 16:04:45 -05:00
parent 95db8533b5
commit e2054c13c8
2 changed files with 32 additions and 2 deletions

View file

@ -65,8 +65,33 @@ class ProvisioningHelper
$this->initializePrefs();
} catch (Exception $e) {
http_response_code(400);
Logging::error($e->getMessage()
);
Logging::error($e->getMessage());
echo $e->getMessage() . PHP_EOL;
return;
}
http_response_code(201);
}
/**
* Endpoint to change Airtime preferences remotely.
* Mainly for use with the dashboard right now.
*/
public function changeAction() {
$apikey = $_SERVER['PHP_AUTH_USER'];
if (!isset($apikey) || $apikey != $this->apikey) {
Logging::info("Invalid API Key: $apikey");
http_response_code(403);
echo "ERROR: Incorrect API key";
return;
}
try {
$this->parsePostParams();
$this->initializePrefs();
} catch (Exception $e) {
http_response_code(400);
Logging::error($e->getMessage());
echo $e->getMessage() . PHP_EOL;
return;
}