-
Notifications
You must be signed in to change notification settings - Fork 451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pkp/pkp-lib#10486 adds validation to prevent an author of a rejected submission from editing metadata in the submission. #10693
base: stable-3_3_0
Are you sure you want to change the base?
Changes from 2 commits
7e5959d
5df4624
4a08436
e49e800
2819c8e
1c03478
bc5e628
2757b51
c7402c4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -795,6 +795,12 @@ public function delete($submission) { | |
public function canEditPublication($submissionId, $userId) { | ||
$stageAssignmentDao = DAORegistry::getDAO('StageAssignmentDAO'); /* @var $stageAssignmentDao StageAssignmentDAO */ | ||
$stageAssignments = $stageAssignmentDao->getBySubmissionAndUserIdAndStageId($submissionId, $userId, null)->toArray(); | ||
$submission = $this->get($submissionId); | ||
$userIsAuthor = !empty($stageAssignmentDao->getBySubmissionAndRoleId($submissionId, ROLE_ID_AUTHOR, null, $userId)->toArray()); | ||
// If the submission is declined and the current user is an author of the submission | ||
if ($submission->getStatus() == STATUS_DECLINED && $userIsAuthor) { | ||
return false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think a more complex policy will be required. If someone is an editor, for example, they probably should have permission to edit metadata on declined submissions they also authored. This restriction should probably apply to submissions only when the author is the only stage assignment. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I added a check if the user doesn't have permissions to edit metadata according to the role. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Sorry, I didn't understand exactly what you meant. Is that a necessary validation in this conditional, too? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I discussed it internally with others and understood the point. In the current PR code, there are still issues, such as an author having the role of Moderator in the OPS but not being able to edit the declined submission. I will make the necessary adjustments. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've adjusted the restriction to apply only in cases where the author has no role other than author/reader. |
||
} | ||
// Check for permission from stage assignments | ||
foreach ($stageAssignments as $stageAssignment) { | ||
if ($stageAssignment->getCanChangeMetadata()) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Every case where
canEditPublication
is called, the$submission
object is already available -- so I'd suggest changing calling code to just pass the submission object instead of$submission->getId()
. That would save the additional (expensive) fetch of the submission object from the DB.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, @asmecher ! 😃
I've adjusted the
canEditPublication
method and updated the calls in lib-pkp. I've also done the PR to include the method call update in OMP and OPS.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@YvesLepidus I think you're missing a PR for OJS too, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't find a call to the
canEditPublication
method in theOJS 3.3.0
source code. 🤔I only found it in the
main
branch, using Repository.