diff --git a/daq/src/aaredaq/auth.py b/daq/src/aaredaq/auth.py index a1eb1718..3f132258 100644 --- a/daq/src/aaredaq/auth.py +++ b/daq/src/aaredaq/auth.py @@ -37,16 +37,15 @@ def authenticate_user(cfg: BeamlineConfig, form_data: OAuth2PasswordRequestForm) user_info = pwd.getpwnam(form_data.username) groups = os.getgrouplist(user_info.pw_name, user_info.pw_gid) - supplementary_groups = [grp.getgrgid(g).gr_name for g in groups] + supplementary_groups = [grp.getgrgid(g).gr_name.lower() for g in groups] pgroups = [group for group in supplementary_groups if group.startswith('p')] - staff = "unx-MXgroup" in supplementary_groups - pgroups.append("p20000") + staff = "unx-mxgroup" in supplementary_groups or "unx-sls_mx" in supplementary_groups token = TokenData(sub=form_data.username, pgroups=pgroups, staff=staff, session=cfg.generate_session()) - + print(f"User {form_data.username} groups: {groups} supplementary groups: {supplementary_groups} pgroups: {pgroups} staff: {staff}") return create_access_token(token)