CC-4604: Edit Metadata: DJ's cannot edit metadata on their own files
-fixed
This commit is contained in:
parent
dfd52eedf1
commit
fc613aa597
|
@ -181,7 +181,8 @@ class LibraryController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
}
|
||||
if ($isAdminOrPM) {
|
||||
|
||||
if ($isAdminOrPM || $file->getFileOwnerId() == $user->getId()) {
|
||||
$menu["del"] = array("name"=> "Delete", "icon" => "delete", "url" => "/library/delete");
|
||||
$menu["edit"] = array("name"=> "Edit Metadata", "icon" => "edit", "url" => "/library/edit-file-md/id/{$id}");
|
||||
}
|
||||
|
@ -364,15 +365,17 @@ class LibraryController extends Zend_Controller_Action
|
|||
{
|
||||
$user = Application_Model_User::getCurrentUser();
|
||||
$isAdminOrPM = $user->isUserType(array(UTYPE_ADMIN, UTYPE_PROGRAM_MANAGER));
|
||||
if (!$isAdminOrPM) {
|
||||
return;
|
||||
}
|
||||
|
||||
$request = $this->getRequest();
|
||||
$form = new Application_Form_EditAudioMD();
|
||||
|
||||
$file_id = $this->_getParam('id', null);
|
||||
$file = Application_Model_StoredFile::Recall($file_id);
|
||||
|
||||
if (!$isAdminOrPM && $file->getFileOwnerId() != $user->getId()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$form = new Application_Form_EditAudioMD();
|
||||
$form->populate($file->getDbColMetadata());
|
||||
|
||||
if ($request->isPost()) {
|
||||
|
|
|
@ -1161,6 +1161,10 @@ SQL;
|
|||
return $this->_file->getDbFileExists();
|
||||
}
|
||||
|
||||
public function getFileOwnerId()
|
||||
{
|
||||
return $this->_file->getDbOwnerId();
|
||||
}
|
||||
|
||||
// note: never call this method from controllers because it does a sleep
|
||||
public function uploadToSoundCloud()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div class="ui-widget ui-widget-content block-shadow simple-formblock clearfix padded-strong">
|
||||
<h2>Edit Metadata</h2>
|
||||
|
||||
<?php $this->form->setAction($this->url());
|
||||
<?php //$this->form->setAction($this->url());
|
||||
echo $this->form; ?>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue