Fix owner field usage (#10)
Reviewed-on: #10 Co-authored-by: Madis Mägi <madis.magi@k-space.ee> Co-committed-by: Madis Mägi <madis.magi@k-space.ee>
This commit is contained in:
parent
91ae9dfcd5
commit
8a63100dc8
@ -24,8 +24,8 @@ async def view_doorboy_uids(request):
|
|||||||
async for obj in db.member.find({"enabled": True}):
|
async for obj in db.member.find({"enabled": True}):
|
||||||
allowed_names.append(obj["_id"])
|
allowed_names.append(obj["_id"])
|
||||||
allowed_uids = []
|
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 }):
|
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_id") in allowed_names:
|
if obj["inventory"].pop("owner").get("foreign_id") in allowed_names:
|
||||||
del obj["_id"]
|
del obj["_id"]
|
||||||
del obj["inventory"]
|
del obj["inventory"]
|
||||||
allowed_uids.append(obj)
|
allowed_uids.append(obj)
|
||||||
|
Loading…
Reference in New Issue
Block a user