sql_app: door: check if valid token on file requests
Signed-off-by: HeshamTB <hishaminv@gmail.com>
This commit is contained in:
parent
b790c6657a
commit
4fdd7c231c
@ -323,7 +323,7 @@ def polling_method_for_room_monitor(request: schemas.IotMonitorRoomInfo,
|
|||||||
def get_allowed_usernames(request: schemas.IotDoorPollingRequest,
|
def get_allowed_usernames(request: schemas.IotDoorPollingRequest,
|
||||||
db: Session = Depends(get_db)):
|
db: Session = Depends(get_db)):
|
||||||
|
|
||||||
iot_door = crud.get_iot_entity_by_bluetooth_mac(db, request.bluetooth_mac)
|
iot_door : models.IotEntity = auth_helper.valid_iot_token(request, db)
|
||||||
if not iot_door:
|
if not iot_door:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||||
@ -339,7 +339,7 @@ def get_allowed_usernames(request: schemas.IotDoorPollingRequest,
|
|||||||
def get_allowed_usernames(request: schemas.IotDoorPollingRequest,
|
def get_allowed_usernames(request: schemas.IotDoorPollingRequest,
|
||||||
db: Session = Depends(get_db)):
|
db: Session = Depends(get_db)):
|
||||||
|
|
||||||
iot_door = crud.get_iot_entity_by_bluetooth_mac(db, request.bluetooth_mac)
|
iot_door : models.IotEntity = auth_helper.valid_iot_token(request, db)
|
||||||
if not iot_door:
|
if not iot_door:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=status.HTTP_401_UNAUTHORIZED,
|
status_code=status.HTTP_401_UNAUTHORIZED,
|
||||||
|
Loading…
Reference in New Issue
Block a user