mirror of
https://github.com/bellingcat/auto-archiver-api.git
synced 2026-06-12 21:48:35 +03:00
exception for group checking
This commit is contained in:
@@ -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
|
# 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()
|
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]
|
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=}")
|
logger.success(f"EMAIL {email} has {user_level_groups=} and {domain_level_groups=}")
|
||||||
return list(set(user_level_groups) | set(domain_level_groups))
|
return list(set(user_level_groups) | set(domain_level_groups))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user