Browse Source

Attribute token.enabled is timestamp, not boolean

pull/10/head
Lauri Võsandi 8 months ago
parent
commit
9bde906929
  1. 13
      README.md
  2. 2
      main.py

13
README.md

@ -1,3 +1,16 @@
# Backgruond
This component serves allowed list of keyfob UID hashes from MongoDB and
pushes open door commands to door controllers.
# Testing endpoints
```
source .env
curl -f http://doorboy.infra.k-space.ee:5000/allowed -H "KEY: $DOORBOY_SECRET" | md5sum
```
# Deploying
```

2
main.py

@ -24,7 +24,7 @@ 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": True}, {"inventory.owner_id": True, "token.uid_hash": True }):
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:
del obj["_id"]
del obj["inventory"]

Loading…
Cancel
Save