Skip to content
Permalink
Browse files

pkp/pkp-lib#4562 Hide edit/delete/upload link actions for galleys fro…

…m authors
  • Loading branch information...
asmecher committed Feb 28, 2019
1 parent ca72d2c commit d0c87f61b66b29a605d50256af804837d9bc6465
@@ -167,7 +167,8 @@ function setDataElementSequence($request, $rowId, $gridDataElement, $newSequence
function getRowInstance() {
import('controllers.grid.articleGalleys.ArticleGalleyGridRow');
return new ArticleGalleyGridRow(
$this->getSubmission()
$this->getSubmission(),
$this->getAuthorizedContextObject(ASSOC_TYPE_USER_ROLES)
);
}
@@ -19,13 +19,17 @@ class ArticleGalleyGridRow extends GridRow {
/** @var Submission **/
var $_submission;
/** @var array */
var $_userRoles;
/**
* Constructor
* @param $submission Submission
* @param $userRoles array
*/
function __construct($submission) {
function __construct($submission, $userRoles) {
$this->_submission = $submission;
$this->_userRoles = $userRoles;
parent::__construct();
}
@@ -47,42 +51,45 @@ function initialize($request, $template = null) {
$actionArgs = $this->getRequestArgs();
$actionArgs['representationId'] = $rowId;
// Add row-level actions
import('lib.pkp.classes.linkAction.request.AjaxModal');
$this->addAction(new LinkAction(
'editGalley',
new AjaxModal(
$router->url($request, null, null, 'editGalley', null, $actionArgs),
__('submission.layout.editGalley'),
'modal_edit'
),
__('grid.action.edit'),
'edit'
));
$galley = $this->getData();
if ($galley->getRemoteUrl() == '') {
import('lib.pkp.controllers.api.file.linkAction.AddFileLinkAction');
import('lib.pkp.classes.submission.SubmissionFile'); // Constants
$this->addAction(new AddFileLinkAction(
$request, $this->getSubmission()->getId(), WORKFLOW_STAGE_ID_PRODUCTION,
array(ROLE_ID_MANAGER, ROLE_ID_SUB_EDITOR, ROLE_ID_ASSISTANT),
SUBMISSION_FILE_PROOF, ASSOC_TYPE_REPRESENTATION, $rowId,
null, $galley->getFileId()
// Authors should not see these links
if (array_intersect(array(ROLE_ID_MANAGER, ROLE_ID_SUB_EDITOR, ROLE_ID_ASSISTANT), $this->_userRoles)) {
// Add row-level actions
import('lib.pkp.classes.linkAction.request.AjaxModal');
$this->addAction(new LinkAction(
'editGalley',
new AjaxModal(
$router->url($request, null, null, 'editGalley', null, $actionArgs),
__('submission.layout.editGalley'),
'modal_edit'
),
__('grid.action.edit'),
'edit'
));
}
import('lib.pkp.classes.linkAction.request.RemoteActionConfirmationModal');
$this->addAction(new LinkAction(
'deleteGalley',
new RemoteActionConfirmationModal(
$request->getSession(),
__('common.confirmDelete'),
$galley = $this->getData();
if ($galley->getRemoteUrl() == '') {
import('lib.pkp.controllers.api.file.linkAction.AddFileLinkAction');
import('lib.pkp.classes.submission.SubmissionFile'); // Constants
$this->addAction(new AddFileLinkAction(
$request, $this->getSubmission()->getId(), WORKFLOW_STAGE_ID_PRODUCTION,
array(ROLE_ID_MANAGER, ROLE_ID_SUB_EDITOR, ROLE_ID_ASSISTANT),
SUBMISSION_FILE_PROOF, ASSOC_TYPE_REPRESENTATION, $rowId,
null, $galley->getFileId()
));
}
import('lib.pkp.classes.linkAction.request.RemoteActionConfirmationModal');
$this->addAction(new LinkAction(
'deleteGalley',
new RemoteActionConfirmationModal(
$request->getSession(),
__('common.confirmDelete'),
__('grid.action.delete'),
$router->url($request, null, null, 'deleteGalley', null, $actionArgs), 'modal_delete'),
__('grid.action.delete'),
$router->url($request, null, null, 'deleteGalley', null, $actionArgs), 'modal_delete'),
__('grid.action.delete'),
'delete'
));
'delete'
));
}
}
}
@@ -57,7 +57,7 @@ function authorize($request, &$args, $roleAssignments) {
}
if ($fileIdToValidate) {
import('lib.pkp.classes.security.authorization.SubmissionFileAccessPolicy');
$this->addPolicy(new SubmissionFileAccessPolicy($request, $args, $roleAssignments, SUBMISSION_FILE_ACCESS_READ, $fileIdToValidate));
$this->addPolicy(new SubmissionFileAccessPolicy($request, $args, $roleAssignments, SUBMISSION_FILE_ACCESS_MODIFY, $fileIdToValidate));
}
// Allow both reviewers (if in review) and context roles.
@@ -240,4 +240,5 @@ Bug Fixes
#4542: Public URL Identifier breaks with a slash character
#4547: "Create Reviewer" reviewer selection option breaks email template
#4561: Fix Google Scholar plugin enabling on upgrade
#4562: Hide edit/delete/upload link actions for galleys from authors

0 comments on commit d0c87f6

Please sign in to comment.
You can’t perform that action at this time.