Browse Source

Fix owner field usage

pull/10/head
Madis Mägi 3 months ago
parent
commit
ef7056a115
  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