Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix http status code when deleting facility with active patients #868

Merged
merged 2 commits into from
Jul 3, 2022

Conversation

Ashesh3
Copy link
Member

@Ashesh3 Ashesh3 commented Jun 22, 2022

This change fixes the HTTP status code sent when deleting a facility with active patients.

Since we already have checked for permissions (we are inside request.user.is_superuser or request.user.user_type >= User.TYPE_VALUE_MAP["DistrictLabAdmin"])

Having verified that we have the permission, deleting a facility with active patients should trigger a 400 BAD REQUEST and NOT a 403 FORBIDDEN.

This also helps the frontend to display the error message in a more friendly manner.

Before:
image

After:
image

@Ashesh3 Ashesh3 requested a review from a team as a code owner June 22, 2022 07:26
@vigneshhari vigneshhari merged commit 14c48e6 into coronasafe:master Jul 3, 2022
@Ashesh3 Ashesh3 deleted the fix-fac-del branch July 3, 2022 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants