mirror of
https://github.com/binary-kitchen/doorlockd
synced 2024-12-22 10:24:26 +01:00
Split up simulation of LDAP and serial
Signed-off-by: Ralf Ramsauer <ralf@binary-kitchen.de>
This commit is contained in:
parent
d52de425ca
commit
201cc2ef9b
@ -1,5 +1,6 @@
|
|||||||
DEBUG = False
|
DEBUG = False
|
||||||
SIMULATE = False
|
SIMULATE_SERIAL = False
|
||||||
|
SIMULATE_LDAP = False
|
||||||
RUN_HOOKS = True
|
RUN_HOOKS = True
|
||||||
SOUNDS = True
|
SOUNDS = True
|
||||||
SECRET_KEY = 'foobar'
|
SECRET_KEY = 'foobar'
|
||||||
|
@ -60,7 +60,8 @@ webapp.config.from_pyfile('config.cfg')
|
|||||||
socketio = SocketIO(webapp, async_mode='threading')
|
socketio = SocketIO(webapp, async_mode='threading')
|
||||||
Bootstrap(webapp)
|
Bootstrap(webapp)
|
||||||
serial_port = webapp.config.get('SERIAL_PORT')
|
serial_port = webapp.config.get('SERIAL_PORT')
|
||||||
simulate = webapp.config.get('SIMULATE')
|
simulate_ldap = webapp.config.get('SIMULATE_LDAP')
|
||||||
|
simulate_serial = webapp.config.get('SIMULATE_SERIAL')
|
||||||
run_hooks = webapp.config.get('RUN_HOOKS')
|
run_hooks = webapp.config.get('RUN_HOOKS')
|
||||||
|
|
||||||
ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_DEMAND)
|
ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap.OPT_X_TLS_DEMAND)
|
||||||
@ -195,7 +196,7 @@ class DoorHandler:
|
|||||||
BUTTON_EMERGENCY_PRESS = b'E'
|
BUTTON_EMERGENCY_PRESS = b'E'
|
||||||
|
|
||||||
def __init__(self, device):
|
def __init__(self, device):
|
||||||
if simulate:
|
if simulate_serial:
|
||||||
return
|
return
|
||||||
|
|
||||||
self.serial = Serial(device, baudrate=9600, bytesize=8, parity='N',
|
self.serial = Serial(device, baudrate=9600, bytesize=8, parity='N',
|
||||||
@ -275,7 +276,7 @@ class Logic:
|
|||||||
self.door_handler = DoorHandler(serial_port)
|
self.door_handler = DoorHandler(serial_port)
|
||||||
|
|
||||||
def _try_auth_ldap(self, user, password):
|
def _try_auth_ldap(self, user, password):
|
||||||
if simulate:
|
if simulate_ldap:
|
||||||
log.info('SIMULATION MODE! ACCEPTING ANYTHING!')
|
log.info('SIMULATION MODE! ACCEPTING ANYTHING!')
|
||||||
return LogicResponse.Success
|
return LogicResponse.Success
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user