diff --git a/app/doorboy-proxy.py b/app/doorboy-proxy.py index 3454f84..559f412 100755 --- a/app/doorboy-proxy.py +++ b/app/doorboy-proxy.py @@ -35,15 +35,16 @@ async def view_doorboy_uids(request): if not key or key not in [DOORBOY_SECRET_FLOOR, DOORBOY_SECRET_WORKSHOP]: return text("how about no") + groups = [] if key == DOORBOY_SECRET_FLOOR: - group = FLOOR_ACCESS_GROUP - elif key == DOORBOY_SECRET_WORKSHOP: - group = WORKSHOP_ACCESS_GROUP - if not group: + groups.append(FLOOR_ACCESS_GROUP) + if key == DOORBOY_SECRET_WORKSHOP: + groups.append(WORKSHOP_ACCESS_GROUP) + if not groups: return "fail", 500 async with httpx.AsyncClient() as client: r = await client.post(CARD_URI, json={ - "groups": [group] + "groups": groups }, headers={ "Content-Type": "application/json", "Authorization": f"Basic {INVENTORY_API_KEY}"