Add active check
This commit is contained in:
@@ -103,6 +103,8 @@ def checkAccess(key: str, db: Session):
|
|||||||
card = db.exec(select(Card).where(Card.key == key)).one()
|
card = db.exec(select(Card).where(Card.key == key)).one()
|
||||||
for auth in card.group.accessauths:
|
for auth in card.group.accessauths:
|
||||||
logger.info(f"checking auth: {auth.name}")
|
logger.info(f"checking auth: {auth.name}")
|
||||||
|
if not auth.is_active:
|
||||||
|
return False
|
||||||
if auth.type == "timetable":
|
if auth.type == "timetable":
|
||||||
for timetable in auth.timetables:
|
for timetable in auth.timetables:
|
||||||
logger.info(f" checking timetable {timetable.id}")
|
logger.info(f" checking timetable {timetable.id}")
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ from desfire.enums import (
|
|||||||
DESFireKeyType,
|
DESFireKeyType,
|
||||||
)
|
)
|
||||||
from desfire.schemas import FilePermissions, FileSettings, KeySettings
|
from desfire.schemas import FilePermissions, FileSettings, KeySettings
|
||||||
from dotenv import load_dotenv
|
|
||||||
from fastapi import HTTPException, status
|
from fastapi import HTTPException, status
|
||||||
from smartcard.CardRequest import CardRequest
|
from smartcard.CardRequest import CardRequest
|
||||||
from smartcard.CardType import AnyCardType
|
from smartcard.CardType import AnyCardType
|
||||||
@@ -30,7 +29,6 @@ from app.services.settings import settings
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
# ENV vars
|
# ENV vars
|
||||||
load_dotenv()
|
|
||||||
MIFARE_APP_MASTER_KEY = settings.mifare_app_master_key
|
MIFARE_APP_MASTER_KEY = settings.mifare_app_master_key
|
||||||
MIFARE_ACL_READ_BASE_KEY = settings.mifare_acl_read_base_key
|
MIFARE_ACL_READ_BASE_KEY = settings.mifare_acl_read_base_key
|
||||||
MIFARE_ACL_WRITE_BASE_KEY = settings.mifare_acl_write_base_key
|
MIFARE_ACL_WRITE_BASE_KEY = settings.mifare_acl_write_base_key
|
||||||
|
|||||||
Reference in New Issue
Block a user