Skip to content

Commit

Permalink
pkp/pkp-lib#6257 Allow authors to upload to their own galleys
Browse files Browse the repository at this point in the history
  • Loading branch information
NateWr committed Oct 5, 2020
1 parent 9540abd commit eecaf16
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions controllers/wizard/fileUpload/FileUploadWizardHandler.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,34 @@

class FileUploadWizardHandler extends PKPFileUploadWizardHandler {

/**
* Constructor
*/
function __construct() {
parent::__construct();
HookRegistry::register('SubmissionFile::assignedFileStageIds', [$this, 'allowAuthorGalleyUploads']);
}

/**
* Modify the assigned file stage ids to allow authors to upload to files to galleys
*
* @param string $hookName
* @param array $args [
* @option array The allowed file stage ids
* @option array The current user's stage assignments
* @option int One of SUBMISSION_FILE_READ or SUBMISSION_FILE_ACCESS_MODIFY
* ]
*/
public function allowAuthorGalleyUploads($hookName, $args) {
$allowedFileStageIds =& $args[0];
$stageAssignments = $args[1];

if (array_key_exists(WORKFLOW_STAGE_ID_PRODUCTION, $stageAssignments)
&& !empty(in_array(ROLE_ID_AUTHOR, $stageAssignments[WORKFLOW_STAGE_ID_PRODUCTION]))) {
$allowedFileStageIds[] = SUBMISSION_FILE_PROOF;
}
}

/**
* @copydoc PKPFileUploadWizardHandler::_attachEntities
*/
Expand Down

0 comments on commit eecaf16

Please sign in to comment.