SAAS-1081 - implement station podcast download counter that resets monthly

This commit is contained in:
Duncan Sommerville 2015-10-21 12:54:50 -04:00
parent 6c0055895c
commit 92ffa955c3
7 changed files with 94 additions and 23 deletions

View file

@ -137,18 +137,20 @@ class LibraryController extends Zend_Controller_Action
if ($isAdminOrPM || $ownerId == $user->getId()) {
$soundcloudService = new Application_Service_SoundcloudService();
if ($type === "audioclip" && $soundcloudService->hasAccessToken()) {
//create a menu separator
$menu["sep1"] = "-----------";
//create a sub menu for Soundcloud actions.
$menu["soundcloud"] = array("name" => _(SOUNDCLOUD), "icon" => "soundcloud", "items" => array());
$serviceId = $soundcloudService->getServiceId($id);
if (!is_null($file) && $serviceId != 0) {
//create a menu separator
$menu["sep1"] = "-----------";
//create a sub menu for Soundcloud actions.
$menu["soundcloud"] = array("name" => _(SOUNDCLOUD), "icon" => "soundcloud", "items" => array());
$menu["soundcloud"]["items"]["view"] = array("name" => _("View track"), "icon" => "soundcloud", "url" => $baseUrl . "soundcloud/view-on-sound-cloud/id/{$id}");
$menu["soundcloud"]["items"]["remove"] = array("name" => _("Remove track"), "icon" => "soundcloud", "url" => $baseUrl . "soundcloud/delete/id/{$id}");
} else {
// $menu["soundcloud"]["items"]["remove"] = array("name" => _("Remove track"), "icon" => "soundcloud", "url" => $baseUrl . "soundcloud/delete/id/{$id}");
}
/*
Since we upload to SoundCloud from the Publish dialog now, this is unnecessary
else {
// If a reference exists for this file ID, that means the user has uploaded the track
// but we haven't yet gotten a response from Celery, so disable the menu item
if ($soundcloudService->referenceExists($id)) {
@ -163,6 +165,7 @@ class LibraryController extends Zend_Controller_Action
);
}
}
*/
}
}
} elseif ($type === "playlist" || $type === "block") {

View file

@ -217,13 +217,13 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
$request->getActionName())) {
/** Redirect to access denied page */
$this->setErrorPage('error403');
$this->denyAccess(); /* This results in a 404! */
$this->denyAccess();
}
}
}
private function verifyAuth() {
if ($this->isVerifiedDownload() || $this->verifyAPIKey()) {
if ($this->verifyAPIKey() || $this->isVerifiedDownload()) {
return true;
}
@ -252,9 +252,7 @@ class Zend_Controller_Plugin_Acl extends Zend_Controller_Plugin_Abstract
$action = $request->getActionName();
$stationPodcast = StationPodcastQuery::create()
->findOneByDbPodcastId(Application_Model_Preference::getStationPodcastId());
return $module == "rest"
&& $controller == "media"
&& $action == "download"
return $module == "rest" && $controller == "media" && $action == "download"
&& $key === Application_Model_Preference::getStationPodcastDownloadKey()
&& $stationPodcast->hasEpisodeForFile($fileId);
}