Skip to content

Commit

Permalink
#3616 reviewers can no access reviews even when the article is in rev…
Browse files Browse the repository at this point in the history
…ision
  • Loading branch information
ajrbyers authored and mauromsl committed Sep 15, 2023
1 parent 661dc70 commit 71a6cee
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/review/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,14 +812,14 @@ def do_review(request, assignment_id):
assignment = models.ReviewAssignment.objects.get(
Q(pk=assignment_id) &
Q(is_complete=False) &
Q(article__stage=submission_models.STAGE_UNDER_REVIEW) &
Q(article__stage__in=submission_models.REVIEW_ACCESSIBLE_STAGES) &
Q(access_code=access_code)
)
else:
assignment = models.ReviewAssignment.objects.get(
Q(pk=assignment_id) &
Q(is_complete=False) &
Q(article__stage=submission_models.STAGE_UNDER_REVIEW) &
Q(article__stage__in=submission_models.REVIEW_ACCESSIBLE_STAGES) &
Q(reviewer=request.user)
)

Expand Down
3 changes: 1 addition & 2 deletions src/security/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,8 +550,7 @@ def wrapper(request, *args, **kwargs):

if assignment:

if assignment.article.stage != models.STAGE_ASSIGNED \
and assignment.article.stage != models.STAGE_UNDER_REVIEW:
if assignment.article.stage not in models.REVIEW_ACCESSIBLE_STAGES:
deny_access(request)
else:
return func(request, *args, **kwargs)
Expand Down
7 changes: 7 additions & 0 deletions src/submission/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,13 @@ def article_media_upload(instance, filename):
STAGE_ACCEPTED,
}

# Stages used to determine if a review assignment is open
REVIEW_ACCESSIBLE_STAGES = {
STAGE_ASSIGNED,
STAGE_UNDER_REVIEW,
STAGE_UNDER_REVISION
}

COPYEDITING_STAGES = {
STAGE_EDITOR_COPYEDITING,
STAGE_AUTHOR_COPYEDITING,
Expand Down

0 comments on commit 71a6cee

Please sign in to comment.