CC-4656: Library -> No error message when a dj tries to delete smart blocks and webstreams they do not own
-fixed
This commit is contained in:
parent
0999b28b2d
commit
5b14c4fe88
|
@ -277,6 +277,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
$streams = array();
|
||||
|
||||
$message = null;
|
||||
$noPermissionMsg = "You don't have permission to delete selected items.";
|
||||
|
||||
foreach ($mediaItems as $media) {
|
||||
|
||||
|
@ -294,19 +295,21 @@ class LibraryController extends Zend_Controller_Action
|
|||
try {
|
||||
Application_Model_Playlist::deletePlaylists($playlists, $user->getId());
|
||||
} catch (PlaylistNoPermissionException $e) {
|
||||
$this->view->message = "You don't have permission to delete selected items.";
|
||||
|
||||
return;
|
||||
$message = $noPermissionMsg;
|
||||
}
|
||||
|
||||
try {
|
||||
Application_Model_Block::deleteBlocks($blocks, $user->getId());
|
||||
} catch (BlockNoPermissionException $e) {
|
||||
$message = $noPermissionMsg;
|
||||
} catch (Exception $e) {
|
||||
//TODO: warn user that not all blocks could be deleted.
|
||||
}
|
||||
|
||||
try {
|
||||
Application_Model_Webstream::deleteStreams($streams, $user->getId());
|
||||
} catch (WebstreamNoPermissionException $e) {
|
||||
$message = $noPermissionMsg;
|
||||
} catch (Exception $e) {
|
||||
//TODO: warn user that not all streams could be deleted.
|
||||
Logging::info($e);
|
||||
|
@ -320,7 +323,7 @@ class LibraryController extends Zend_Controller_Action
|
|||
try {
|
||||
$res = $file->delete(true);
|
||||
} catch (FileNoPermissionException $e) {
|
||||
$this->view->message = "You don't have permission to delete selected items.";
|
||||
$message = $noPermissionMsg;
|
||||
} catch (Exception $e) {
|
||||
//could throw a scheduled in future exception.
|
||||
$message = "Could not delete some scheduled files.";
|
||||
|
|
|
@ -92,7 +92,7 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
|||
if (count($leftOver) == 0) {
|
||||
CcWebstreamQuery::create()->findPKs($p_ids)->delete();
|
||||
} else {
|
||||
throw new Exception("Invalid user permissions");
|
||||
throw new WebstreamNoPermissionException;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -370,3 +370,6 @@ class Application_Model_Webstream implements Application_Model_LibraryEditable
|
|||
return $webstream->getDbId();
|
||||
}
|
||||
}
|
||||
|
||||
class WebstreamNoPermissionException extends Exception {}
|
||||
|
||||
|
|
Loading…
Reference in New Issue