Skip to content

Commit af8afcd

Browse files
committed
Require staff/superuser access for mailchimp csv endpoint
1 parent ff06361 commit af8afcd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

dandiapi/api/views/dashboard.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ def _users(self):
8989

9090
def mailchimp_csv_view(request: HttpRequest) -> StreamingHttpResponse:
9191
"""Generate a Mailchimp-compatible CSV file of all active users."""
92+
# If they are authenticated but are not a superuser or staff, deny access
93+
if not (request.user.is_superuser or request.user.is_staff):
94+
raise PermissionDenied
95+
9296
# Exclude the django-guardian anonymous user account.
9397
users = User.objects.filter(metadata__status=UserMetadata.Status.APPROVED).exclude(
9498
username='AnonymousUser'

0 commit comments

Comments
 (0)