Skip to content
Snippets Groups Projects
Commit 1e5f3faf authored by Parbhat Puri's avatar Parbhat Puri Committed by Fredrik Jonsson
Browse files

Allow partners to view submission detail for which they are added as partner

parent 6c111286
No related branches found
No related tags found
No related merge requests found
...@@ -328,6 +328,11 @@ class AdminSubmissionDetailView(ReviewContextMixin, ActivityContextMixin, Delega ...@@ -328,6 +328,11 @@ class AdminSubmissionDetailView(ReviewContextMixin, ActivityContextMixin, Delega
def dispatch(self, request, *args, **kwargs): def dispatch(self, request, *args, **kwargs):
submission = self.get_object() submission = self.get_object()
# Only allow partners in the submission they are added as partners
if request.user.is_partner:
partner_has_access = submission.partners.filter(pk=request.user.pk).exists()
if not partner_has_access:
raise PermissionDenied
redirect = SubmissionSealedView.should_redirect(request, submission) redirect = SubmissionSealedView.should_redirect(request, submission)
return redirect or super().dispatch(request, *args, **kwargs) return redirect or super().dispatch(request, *args, **kwargs)
......
...@@ -103,7 +103,7 @@ class User(AbstractUser): ...@@ -103,7 +103,7 @@ class User(AbstractUser):
@cached_property @cached_property
def is_applicant(self): def is_applicant(self):
return not self.is_apply_staff and not self.is_reviewer return not self.is_apply_staff and not self.is_reviewer and not self.is_partner
class Meta: class Meta:
ordering = ('full_name', 'email') ordering = ('full_name', 'email')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment