Fix #28
This commit is contained in:
@@ -29,7 +29,7 @@ class DoorController:
|
||||
if not mock_factory:
|
||||
import paho.mqtt.client as mqtt
|
||||
self._mqtt = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2)
|
||||
self._mqtt.connect(mqtt_host, mqtt_port)
|
||||
self._mqtt.connect(mqtt_host, mqtt_port) #TODO: add login with username+pw, tls
|
||||
self._mqtt.loop_start()
|
||||
logger.info("Mqtt client connect to %s:%s", mqtt_host, mqtt_port)
|
||||
|
||||
@@ -102,11 +102,13 @@ def checkAccess(key: str, db: Session):
|
||||
current_time = datetime.now()
|
||||
card = db.exec(select(Card).where(Card.key == key)).one()
|
||||
if not card.enabled:
|
||||
logger.info("Card Inactive!")
|
||||
return False
|
||||
for auth in card.group.accessauths:
|
||||
logger.info(f"checking auth: {auth.name}")
|
||||
if not auth.is_active:
|
||||
return False
|
||||
logger.info("AA inactive!")
|
||||
continue
|
||||
if auth.type == "timetable":
|
||||
for timetable in auth.timetables:
|
||||
logger.info(f" checking timetable {timetable.id}")
|
||||
|
||||
Reference in New Issue
Block a user