From a0b467b9d947d27c2b8dba67110a154a3509814a Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Mon, 14 Oct 2024 17:56:53 -0400 Subject: [PATCH 1/2] Auto-allow people with @alleninstitute.org email addresses --- dandiapi/api/views/auth.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dandiapi/api/views/auth.py b/dandiapi/api/views/auth.py index 1232bbaa8..1e1249028 100644 --- a/dandiapi/api/views/auth.py +++ b/dandiapi/api/views/auth.py @@ -124,7 +124,9 @@ def user_questionnaire_form_view(request: HttpRequest) -> HttpResponse: not questionnaire_already_filled_out and user_metadata.status == UserMetadata.Status.INCOMPLETE ): - is_edu_email: bool = user.email.endswith('.edu') + is_edu_email: bool = user.email.endswith('.edu') or user.email.endswith( + '@alleninstitute.org' + ) # auto-approve users with edu emails, otherwise require manual approval user_metadata.status = ( From ee88c245f91710b9a1f40632c0b01106396a2f0c Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Tue, 15 Oct 2024 11:41:10 -0400 Subject: [PATCH 2/2] Rename is_edu_email to more adequate now show_auto_approve --- dandiapi/api/views/auth.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dandiapi/api/views/auth.py b/dandiapi/api/views/auth.py index 1e1249028..6525ff73a 100644 --- a/dandiapi/api/views/auth.py +++ b/dandiapi/api/views/auth.py @@ -124,13 +124,13 @@ def user_questionnaire_form_view(request: HttpRequest) -> HttpResponse: not questionnaire_already_filled_out and user_metadata.status == UserMetadata.Status.INCOMPLETE ): - is_edu_email: bool = user.email.endswith('.edu') or user.email.endswith( + should_auto_approve: bool = user.email.endswith('.edu') or user.email.endswith( '@alleninstitute.org' ) # auto-approve users with edu emails, otherwise require manual approval user_metadata.status = ( - UserMetadata.Status.APPROVED if is_edu_email else UserMetadata.Status.PENDING + UserMetadata.Status.APPROVED if should_auto_approve else UserMetadata.Status.PENDING ) user_metadata.save(update_fields=['status'])