add /open-all-doors

This commit is contained in:
rasmus 2023-08-17 22:04:20 +03:00
parent 2134512805
commit cdfe6373e1

View File

@ -71,7 +71,7 @@ def view_slack_doorboy():
command = request.form.get("command") command = request.form.get("command")
try: try:
door = { door = {
"/open-new-door": "backdoor", "/open-all-doors": "outsidedoors",
"/open-back-door": "backdoor", "/open-back-door": "backdoor",
"/open-front-door": "frontdoor", "/open-front-door": "frontdoor",
"/open-ground-door": "grounddoor", "/open-ground-door": "grounddoor",
@ -91,17 +91,23 @@ def view_slack_doorboy():
else: else:
access_group = "k-space:floor" access_group = "k-space:floor"
approved = access_group in member.groups approved = access_group in member.groups
db.eventlog.insert_one({
"method": "slack", doors = [door]
"approved": approved, if door == "outsidedoors":
"duration": 5, doors = ["backdoor", "frontdoor", "grounddoor"]
"component": "doorboy",
"type": "open-door", for door in doors:
"door": door, db.eventlog.insert_one({
"member_id": member.username, "method": "slack",
"member": member.display_name, "approved": approved,
"timestamp": datetime.utcnow(), "duration": 5,
}) "component": "doorboy",
"type": "open-door",
"door": door,
"member_id": member.username,
"member": member.display_name,
"timestamp": datetime.utcnow(),
})
status = "Permitted" if approved else "Denied" status = "Permitted" if approved else "Denied"
subject = member.display_name subject = member.display_name