add /open-all-doors
This commit is contained in:
parent
2134512805
commit
cdfe6373e1
@ -71,7 +71,7 @@ def view_slack_doorboy():
|
||||
command = request.form.get("command")
|
||||
try:
|
||||
door = {
|
||||
"/open-new-door": "backdoor",
|
||||
"/open-all-doors": "outsidedoors",
|
||||
"/open-back-door": "backdoor",
|
||||
"/open-front-door": "frontdoor",
|
||||
"/open-ground-door": "grounddoor",
|
||||
@ -91,17 +91,23 @@ def view_slack_doorboy():
|
||||
else:
|
||||
access_group = "k-space:floor"
|
||||
approved = access_group in member.groups
|
||||
db.eventlog.insert_one({
|
||||
"method": "slack",
|
||||
"approved": approved,
|
||||
"duration": 5,
|
||||
"component": "doorboy",
|
||||
"type": "open-door",
|
||||
"door": door,
|
||||
"member_id": member.username,
|
||||
"member": member.display_name,
|
||||
"timestamp": datetime.utcnow(),
|
||||
})
|
||||
|
||||
doors = [door]
|
||||
if door == "outsidedoors":
|
||||
doors = ["backdoor", "frontdoor", "grounddoor"]
|
||||
|
||||
for door in doors:
|
||||
db.eventlog.insert_one({
|
||||
"method": "slack",
|
||||
"approved": approved,
|
||||
"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"
|
||||
subject = member.display_name
|
||||
|
Loading…
Reference in New Issue
Block a user