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

Allow district admin to delete users #1738

Merged
merged 1 commit into from
Dec 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions care/users/api/viewsets/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@
user_type__lt=User.TYPE_VALUE_MAP["StateAdmin"],
is_superuser=False,
)
elif request.user.user_type == User.TYPE_VALUE_MAP["DistrictAdmin"]:
queryset = queryset.filter(

Check warning on line 155 in care/users/api/viewsets/users.py

View check run for this annotation

Codecov / codecov/patch

care/users/api/viewsets/users.py#L155

Added line #L155 was not covered by tests
district=request.user.district,
user_type__lt=User.TYPE_VALUE_MAP["DistrictAdmin"],
is_superuser=False,
)
else:
return Response(
status=status.HTTP_403_FORBIDDEN, data={"permission": "Denied"}
Expand Down
Loading