diff --git a/airtime_mvc/application/configs/ACL.php b/airtime_mvc/application/configs/ACL.php index 585227215..07ca7d822 100644 --- a/airtime_mvc/application/configs/ACL.php +++ b/airtime_mvc/application/configs/ACL.php @@ -59,8 +59,9 @@ $ccAcl->allow('G', 'index') ->allow('G', 'provisioning') ->allow('G', 'downgrade') ->allow('G', 'rest:show-image', 'get') - ->allow('H', 'rest:show-image') ->allow('G', 'rest:media', 'get') + ->allow('H', 'soundcloud') + ->allow('H', 'rest:show-image') ->allow('H', 'rest:media') ->allow('H', 'preference', 'is-import-in-progress') ->allow('H', 'usersettings') @@ -74,7 +75,6 @@ $ccAcl->allow('G', 'index') ->allow('A', 'systemstatus') ->allow('A', 'preference') ->allow('A', 'player') - ->allow('A', 'soundcloud') ->allow('A', 'embeddablewidgets') ->allow('S', 'thank-you') ->allow('S', 'billing'); diff --git a/airtime_mvc/application/controllers/LibraryController.php b/airtime_mvc/application/controllers/LibraryController.php index e2de84adf..2ad032973 100644 --- a/airtime_mvc/application/controllers/LibraryController.php +++ b/airtime_mvc/application/controllers/LibraryController.php @@ -266,28 +266,35 @@ class LibraryController extends Zend_Controller_Action } // SOUNDCLOUD MENU OPTION - $soundcloudService = new SoundcloudService(); - if ($type === "audioclip" && $soundcloudService->hasAccessToken()) { + $ownerId = empty($obj) ? $file->getFileOwnerId() : $obj->getCreatorId(); + if ($isAdminOrPM || $ownerId == $user->getId()) { + $soundcloudService = new SoundcloudService(); + if ($type === "audioclip" && $soundcloudService->hasAccessToken()) { - //create a menu separator - $menu["sep1"] = "-----------"; + //create a menu separator + $menu["sep1"] = "-----------"; - //create a sub menu for Soundcloud actions. - $menu["soundcloud"] = array("name" => _("Soundcloud"), "icon" => "soundcloud", "items" => array()); + //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) { - $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 { - // 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)) { - $menu["soundcloud"]["items"]["upload"] = array("name" => _("Upload track"), "icon" => "soundcloud", - "url" => $baseUrl."soundcloud/upload/id/{$id}", "disabled" => true); + $serviceId = $soundcloudService->getServiceId($id); + if (!is_null($file) && $serviceId != 0) { + $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"]["upload"] = array("name" => _("Upload track"), "icon" => "soundcloud", - "url" => $baseUrl."soundcloud/upload/id/{$id}"); + // 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)) { + $menu["soundcloud"]["items"]["upload"] = array( + "name" => _("Upload track"), "icon" => "soundcloud", + "url" => $baseUrl . "soundcloud/upload/id/{$id}", "disabled" => true + ); + } else { + $menu["soundcloud"]["items"]["upload"] = array( + "name" => _("Upload track"), "icon" => "soundcloud", + "url" => $baseUrl . "soundcloud/upload/id/{$id}" + ); + } } } }