Use NoAccessError instead of NotFoundError where a resource exists but the user cannot access it because of the state of the resource
This commit is contained in:
parent
5f30b347c7
commit
9a97b75d71
@ -126,9 +126,12 @@ def resend_invite(portfolio_id, task_order_id, form=None):
|
|||||||
|
|
||||||
invitation = Invitations.lookup_by_portfolio_and_user(portfolio, officer)
|
invitation = Invitations.lookup_by_portfolio_and_user(portfolio, officer)
|
||||||
|
|
||||||
if not invitation or (invitation.status is not InvitationStatus.PENDING):
|
if not invitation:
|
||||||
raise NotFoundError("invitation")
|
raise NotFoundError("invitation")
|
||||||
|
|
||||||
|
if invitation.status is not InvitationStatus.PENDING:
|
||||||
|
raise NoAccessError("invitation")
|
||||||
|
|
||||||
Invitations.revoke(token=invitation.token)
|
Invitations.revoke(token=invitation.token)
|
||||||
|
|
||||||
invite_service = InvitationService(
|
invite_service = InvitationService(
|
||||||
@ -210,7 +213,7 @@ def task_order_invitations(portfolio_id, task_order_id):
|
|||||||
form=form,
|
form=form,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
raise NotFoundError("task_order")
|
raise NoAccessError("task_order")
|
||||||
|
|
||||||
|
|
||||||
@portfolios_bp.route(
|
@portfolios_bp.route(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user