Skip to content

Commit

Permalink
pkp#10486 The restriction is only applied if the author has the exclu…
Browse files Browse the repository at this point in the history
…sive role of author/reader

Signed-off-by: yves <[email protected]>
  • Loading branch information
YvesLepidus committed Dec 18, 2024
1 parent e49e800 commit 2819c8e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions classes/services/PKPSubmissionService.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -797,8 +797,15 @@ public function canEditPublication($submission, $userId) {
$stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); /* @var $stageAssignmentDao StageAssignmentDAO */
$stageAssignments = $stageAssignmentDao->getBySubmissionAndUserIdAndStageId($submission->getId(), $userId, null)->toArray();
$userIsAuthor = !empty($stageAssignmentDao->getBySubmissionAndRoleId($submission->getId(), ROLE_ID_AUTHOR, null, $userId)->toArray());
// If the user is an author of a declined submission and user can't edit anyway ie. is not manager
if ($submission->getStatus() == STATUS_DECLINED && $userIsAuthor && !$this->_canUserAccessUnassignedSubmissions($contextId, $userId)) {
// If the submission is rejected and the user's only role is an author
if ($submission->getStatus() == STATUS_DECLINED && $userIsAuthor) {
$roleDao = DAORegistry::getDAO('RoleDAO'); /* @var $roleDao RoleDAO */
$roles = $roleDao->getByUserId($userId, $contextId);
foreach ($roles as $role) {
if ($role->getRoleId() != ROLE_ID_AUTHOR && $role->getRoleId() != ROLE_ID_READER) {
return true;
}
}
return false;
}
// Check for permission from stage assignments
Expand Down

0 comments on commit 2819c8e

Please sign in to comment.