Fix can_view_submission ignoring ReviewerSettings configured in wagtail admin#4899
Merged
Conversation
frjo
requested changes
Jul 7, 2026
| or submission.user == user | ||
| or user.is_reviewer | ||
| or submission.co_applicants.filter(user=user).exists() | ||
| ): |
Member
There was a problem hiding this comment.
I think it would be most correct to move these above if user.is_reviewer:.
If e.g. a user is staff and reviewer the staff role should take precedence.
Contributor
Author
There was a problem hiding this comment.
totally makes sense!
| if reviewer_settings.use_settings: | ||
| qs = qs.for_reviewer_settings(request.user, reviewer_settings) | ||
| else: | ||
| qs = qs.filter(reviewers=request.user) |
Contributor
Author
|
should be fixed now @frjo ! |
frjo
approved these changes
Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixed a permission bug that ignored the ReviewerSettings that were set in Wagtail admin.
By default (no settings configured) a reviewer should have access to all submissions. But in Wagtail, setting can be configured to scope a reviewer's specific access to things like assigned applications, specific application outcomes, etc. This was not being considered by
can_view_submission, which would give reviewers access to things like attachments on applications they wouldn't otherwise have access to.The logic for ReviewerSettings was implemented on the
ReviewerSubmissionDetailViewalone so the detail view would account for these settings but not thecan_view_submissionfunction itself.Thank you to https://github.com/Santoshkumarpuppala for discovering and responsibly disclosing this bug!
Test Steps