Browse Source

Fix owner field usage (#10)

Reviewed-on: https://git.k-space.ee/k-space/doorboy-proxy/pulls/10
Co-authored-by: Madis Mägi <madis.magi@k-space.ee>
Co-committed-by: Madis Mägi <madis.magi@k-space.ee>
pull/11/head
Madis Mägi 3 months ago
committed by Lauri Võsandi
parent
commit
8a63100dc8
  1. 4
      doorboy.py

4
doorboy.py

@ -24,8 +24,8 @@ async def view_doorboy_uids(request):
async for obj in db.member.find({"enabled": True}):
allowed_names.append(obj["_id"])
allowed_uids = []
async for obj in db.inventory.find({"token.uid_hash": {"$exists":True}, "inventory.owner_id": {"$exists":True}, "token.enabled": {"$exists":True}}, {"inventory.owner_id": True, "token.uid_hash": True }):
if obj["inventory"].pop("owner_id") in allowed_names:
async for obj in db.inventory.find({"token.uid_hash": {"$exists":True}, "inventory.owner": {"$exists":True}, "token.enabled": {"$exists":True}}, {"inventory.owner": True, "token.uid_hash": True }):
if obj["inventory"].pop("owner").get("foreign_id") in allowed_names:
del obj["_id"]
del obj["inventory"]
allowed_uids.append(obj)

Loading…
Cancel
Save