CC-1665: Scheduled stream rebroadcasting and recording
-Make playlist builder show creator name instead of creator id
This commit is contained in:
parent
b23b9a0cbd
commit
f901e13a84
8 changed files with 59 additions and 47 deletions
|
@ -34,7 +34,6 @@ class WebstreamController extends Zend_Controller_Action
|
|||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
|
||||
$id = $request->getParam("id");
|
||||
if (is_null($id)) {
|
||||
throw new Exception("Missing parameter 'id'");
|
||||
|
@ -48,10 +47,35 @@ class WebstreamController extends Zend_Controller_Action
|
|||
{
|
||||
$request = $this->getRequest();
|
||||
|
||||
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
$hasPermission = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER, UTYPE_HOST));
|
||||
$id = $request->getParam("id");
|
||||
|
||||
if ($id == -1) {
|
||||
$webstream = new CcWebstream();
|
||||
} else {
|
||||
$webstream = CcWebstreamQuery::create()->findPK($id);
|
||||
}
|
||||
|
||||
if ($id != -1) {
|
||||
//we are updating a playlist. Ensure that if the user is a host/dj, that he has the correct permission.
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
if ($webstream->getDbCreatorId() != $user->getId()) {
|
||||
header("Status: 401 Not Authorized");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$hasPermission) {
|
||||
header("Status: 401 Not Authorized");
|
||||
return;
|
||||
}
|
||||
|
||||
$analysis = Application_Model_Webstream::analyzeFormData($request);
|
||||
|
||||
if (Application_Model_Webstream::isValid($analysis)) {
|
||||
Application_Model_Webstream::save($request);
|
||||
Application_Model_Webstream::save($request, $webstream);
|
||||
$this->view->statusMessage = "<div class='success'>Webstream saved.</div>";
|
||||
} else {
|
||||
$this->view->statusMessage = "<div class='errors'>Invalid form values.</div>";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue