CC-2529: Create download file API key

-users who are authenticed via ZEND_AUTH can now preview files
 without using api-key
This commit is contained in:
martin 2011-07-12 14:09:40 -04:00
parent 88bdb4840b
commit 1416274882
4 changed files with 5 additions and 8 deletions

View file

@ -74,8 +74,9 @@ class ApiController extends Zend_Controller_Action
$download = ("true" == $this->_getParam('download')); $download = ("true" == $this->_getParam('download'));
$logger = Logging::getLogger(); $logger = Logging::getLogger();
if(!in_array($api_key, $CC_CONFIG["apiKey"])) if(!in_array($api_key, $CC_CONFIG["apiKey"]) &&
is_null(Zend_Auth::getInstance()->getStorage()->read()))
{ {
header('HTTP/1.0 401 Unauthorized'); header('HTTP/1.0 401 Unauthorized');
print 'You are not allowed to access this resource.'; print 'You are not allowed to access this resource.';

View file

@ -376,8 +376,7 @@ class Schedule {
"currentShow"=>Show_DAL::GetCurrentShow($timeNow), "currentShow"=>Show_DAL::GetCurrentShow($timeNow),
"nextShow"=>Show_DAL::GetNextShows($timeNow, 1), "nextShow"=>Show_DAL::GetNextShows($timeNow, 1),
"timezone"=> date("T"), "timezone"=> date("T"),
"timezoneOffset"=> date("Z"), "timezoneOffset"=> date("Z"));
"apiKey"=>$CC_CONFIG['apiKey'][0]);
} }
public static function GetLastScheduleItem($p_timeNow){ public static function GetLastScheduleItem($p_timeNow){

View file

@ -152,7 +152,7 @@ function audioPreview(filename, elemID){
} }
var ext = getFileExt(filename); var ext = getFileExt(filename);
var uri = "/api/get-media/api_key/" + apiKey + "/file/" + filename; var uri = "/api/get-media/file/" + filename;
var media; var media;
var supplied; var supplied;

View file

@ -23,8 +23,6 @@ var APPLICATION_ENV = "";
var nextSongPrepare = true; var nextSongPrepare = true;
var nextShowPrepare = true; var nextShowPrepare = true;
var apiKey = "";
function secondsTimer(){ function secondsTimer(){
if (localRemoteTimeOffset !== null){ if (localRemoteTimeOffset !== null){
var date = new Date(); var date = new Date();
@ -190,7 +188,6 @@ function calcAdditionalShowData(show){
function parseItems(obj){ function parseItems(obj){
APPLICATION_ENV = obj.env; APPLICATION_ENV = obj.env;
apiKey = obj.apiKey;
$('#time-zone').text(obj.timezone); $('#time-zone').text(obj.timezone);