From 2f919b44ae9902920a92d6cf9a1647138806c368 Mon Sep 17 00:00:00 2001 From: Dylan McReynolds Date: Thu, 25 Apr 2024 11:29:18 -0700 Subject: [PATCH] protect against not being in admin group --- alshub/service.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/alshub/service.py b/alshub/service.py index a56921d..20a23a7 100644 --- a/alshub/service.py +++ b/alshub/service.py @@ -185,7 +185,9 @@ async def get_staff_beamlines(ac: AsyncClient, orcid: str, email: str) -> List[s # ALSHub beamlines = set() if ADMINS: - beamlines.update(ADMINS[email]) + admin = ADMINS.get(email) + if admin: + beamlines.update(ADMINS.get(email)) if response.is_error: info(f"error asking ALHub for staff roles {orcid}") return beamlines