enable caldav access check

This commit is contained in:
2026-11-02 19:53:34 +01:00
parent 7e39fa2c1e
commit 6666f47f1f
+8 -2
View File
@@ -8,6 +8,7 @@ from sqlmodel import select
from app.model.models import Card, OneShotAccess
from app.services.database import Session, add_and_refresh
logger = logging.getLogger(__name__)
@@ -98,12 +99,17 @@ def decrementOneshot(db: Session, oneshot: OneShotAccess):
def checkAccess(key: str, db: Session):
try:
current_weekday = datetime.weekday(date.today())
current_time = datetime.now()
card = db.exec(select(Card).where(Card.key == key)).one()
if not card.enabled:
logger.info("Card Inactive!")
return False
if caldav_handler.is_group_active(card.group.name):
logger.info("Access Valid!")
return True
current_weekday = datetime.weekday(date.today())
current_time = datetime.now()
for auth in card.group.accessauths:
logger.info(f"checking auth: {auth.name}")
if not auth.is_active: