Skip to content

Commit

Permalink
Handling query error for duplicate editors (#4424)
Browse files Browse the repository at this point in the history
* Handling query error for multiple editors

* Handling query error for multiple editors
  • Loading branch information
phildominguez-gsa authored Oct 31, 2024
1 parent 1c18153 commit 8973e32
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions backend/audit/views/manage_submission_access.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ def get(self, request, *args, **kwargs):
report_id = kwargs["report_id"]
sac = SingleAuditChecklist.objects.get(report_id=report_id)

try:
Access.objects.get(email=request.user.email, sac=sac, role=self.role)
except Access.DoesNotExist:
if not Access.objects.filter(
email=request.user.email, sac=sac, role=self.role
).exists():
raise PermissionDenied(
"Only Audit Editors may remove audit access for other Audit Editors."
)
Expand Down Expand Up @@ -240,9 +240,9 @@ def post(self, request, *args, **kwargs):
report_id = kwargs["report_id"]
sac = SingleAuditChecklist.objects.get(report_id=report_id)

try:
Access.objects.get(email=request.user.email, sac=sac, role=self.role)
except Access.DoesNotExist:
if not Access.objects.filter(
email=request.user.email, sac=sac, role=self.role
).exists():
raise PermissionDenied(
"Only Audit Editors may remove audit access for other Audit Editors."
)
Expand Down

0 comments on commit 8973e32

Please sign in to comment.