CC-3592 : Calendar-> Recorded Shows do not get Rebroadcasted at the moment
added a flag whether to check user permissions or not.
This commit is contained in:
parent
d06b3573e9
commit
adddd1085c
|
@ -17,7 +17,9 @@ class Application_Model_Scheduler {
|
||||||
private $nowDT;
|
private $nowDT;
|
||||||
private $user;
|
private $user;
|
||||||
|
|
||||||
public function __construct($id = null) {
|
private $checkUserPermissions = true;
|
||||||
|
|
||||||
|
public function __construct() {
|
||||||
|
|
||||||
$this->con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
$this->con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
|
||||||
|
|
||||||
|
@ -27,6 +29,11 @@ class Application_Model_Scheduler {
|
||||||
$this->user = Application_Model_User::GetCurrentUser();
|
$this->user = Application_Model_User::GetCurrentUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function setCheckUserPermissions($value) {
|
||||||
|
$this->checkUserPermissions = $value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* make sure any incoming requests for scheduling are ligit.
|
* make sure any incoming requests for scheduling are ligit.
|
||||||
*
|
*
|
||||||
|
@ -83,7 +90,7 @@ class Application_Model_Scheduler {
|
||||||
$id = $instance->getDbId();
|
$id = $instance->getDbId();
|
||||||
$show = $instance->getCcShow($this->con);
|
$show = $instance->getCcShow($this->con);
|
||||||
|
|
||||||
if ($this->user->canSchedule($show->getDbId()) === false) {
|
if ($this->checkUserPermissions && $this->user->canSchedule($show->getDbId()) === false) {
|
||||||
throw new Exception("You are not allowed to schedule show {$show->getDbName()}.");
|
throw new Exception("You are not allowed to schedule show {$show->getDbName()}.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -352,7 +352,7 @@ class Application_Model_ShowInstance {
|
||||||
* @param int $plId
|
* @param int $plId
|
||||||
* Playlist ID.
|
* Playlist ID.
|
||||||
*/
|
*/
|
||||||
public function addPlaylistToShow($pl_id)
|
public function addPlaylistToShow($pl_id, $checkUserPerm = true)
|
||||||
{
|
{
|
||||||
$ts = intval($this->_showInstance->getDbLastScheduled("U")) ? : 0;
|
$ts = intval($this->_showInstance->getDbLastScheduled("U")) ? : 0;
|
||||||
$id = $this->_showInstance->getDbId();
|
$id = $this->_showInstance->getDbId();
|
||||||
|
@ -369,12 +369,13 @@ class Application_Model_ShowInstance {
|
||||||
*
|
*
|
||||||
* @param int $file_id
|
* @param int $file_id
|
||||||
*/
|
*/
|
||||||
public function addFileToShow($file_id)
|
public function addFileToShow($file_id, $checkUserPerm = true)
|
||||||
{
|
{
|
||||||
$ts = intval($this->_showInstance->getDbLastScheduled("U")) ? : 0;
|
$ts = intval($this->_showInstance->getDbLastScheduled("U")) ? : 0;
|
||||||
$id = $this->_showInstance->getDbId();
|
$id = $this->_showInstance->getDbId();
|
||||||
|
|
||||||
$scheduler = new Application_Model_Scheduler();
|
$scheduler = new Application_Model_Scheduler();
|
||||||
|
$scheduler->setCheckUserPermissions($checkUserPerm);
|
||||||
$scheduler->scheduleAfter(
|
$scheduler->scheduleAfter(
|
||||||
array(array("id" => 0, "instance" => $id, "timestamp" => $ts)),
|
array(array("id" => 0, "instance" => $id, "timestamp" => $ts)),
|
||||||
array(array("id" => $file_id, "type" => "audioclip"))
|
array(array("id" => $file_id, "type" => "audioclip"))
|
||||||
|
@ -553,7 +554,7 @@ class Application_Model_ShowInstance {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$rebroad = new Application_Model_ShowInstance($rebroadcast->getDbId());
|
$rebroad = new Application_Model_ShowInstance($rebroadcast->getDbId());
|
||||||
$rebroad->addFileToShow($file_id);
|
$rebroad->addFileToShow($file_id, false);
|
||||||
}
|
}
|
||||||
catch (Exception $e) {
|
catch (Exception $e) {
|
||||||
Logging::log("{$e->getFile()}");
|
Logging::log("{$e->getFile()}");
|
||||||
|
|
Loading…
Reference in New Issue