diff --git a/src/db/crud.py b/src/db/crud.py index a4dd1ff..efecd40 100644 --- a/src/db/crud.py +++ b/src/db/crud.py @@ -112,7 +112,10 @@ def get_user_groups(db: Session, email: str): # given an email retrieves the user groups from the DB and then the email-domain groups from a global variable groups = db.query(models.association_table_user_groups).filter_by(user_id=email).with_entities(Column("group_id")).all() user_level_groups = [g[0] for g in groups] - domain_level_groups = DOMAIN_GROUPS.get(email.split('@')[1], []) + if email != ALLOW_ANY_EMAIL: + domain_level_groups = DOMAIN_GROUPS.get(email.split('@')[1], []) + else: + domain_level_groups = [] logger.success(f"EMAIL {email} has {user_level_groups=} and {domain_level_groups=}") return list(set(user_level_groups) | set(domain_level_groups))