- Correctie reset password en confirm email adress by adapting the prefixed_url_for to use config setting
- Adaptation of DPA and T&Cs - Refer to privacy statement as DPA, not a privacy statement - Startup of enforcing signed DPA and T&Cs - Adaptation of eveai_chat_client to ensure we retrieve correct DPA & T&Cs
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
from typing import Dict, List
|
||||
|
||||
from flask import session, current_app
|
||||
from sqlalchemy import desc
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
|
||||
from common.extensions import db, cache_manager
|
||||
from common.models.user import Partner, PartnerTenant, PartnerService, Tenant
|
||||
from common.models.user import Partner, PartnerTenant, PartnerService, Tenant, TenantConsent, ConsentStatus, \
|
||||
ConsentVersion
|
||||
from common.utils.eveai_exceptions import EveAINoManagementPartnerService
|
||||
from common.utils.model_logging_utils import set_logging_information
|
||||
from datetime import datetime as dt, timezone as tz
|
||||
@@ -172,4 +174,30 @@ class TenantServices:
|
||||
|
||||
except Exception as e:
|
||||
current_app.logger.error(f"Error checking specialist type access: {str(e)}")
|
||||
return False
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def get_consent_status(tenant_id: int) -> ConsentStatus:
|
||||
cts = current_app.config.get("CONSENT_TYPES")
|
||||
status = ConsentStatus.CONSENTED
|
||||
for ct in cts:
|
||||
consent = (TenantConsent.query.filter_by(tenant_id=tenant_id, consent_type=ct)
|
||||
.order_by(desc(TenantConsent.id))
|
||||
.first())
|
||||
if not consent:
|
||||
status = ConsentStatus.NOT_CONSENTED
|
||||
break
|
||||
cv = ConsentVersion.query.filter_by(consent_type=ct, consent_version=consent.consent_version).first()
|
||||
if not cv:
|
||||
current_app.logger.error(f"Consent version {consent.consent_version} not found checking tenant {tenant_id}")
|
||||
status = ConsentStatus.UNKNOWN_CONSENT_VERSION
|
||||
break
|
||||
if cv.consent_valid_to:
|
||||
if cv.consent_valid_to.date() >= dt.now(tz.utc).date():
|
||||
status = ConsentStatus.RENEWAL_REQUIRED
|
||||
break
|
||||
else:
|
||||
status = ConsentStatus.NOT_CONSENTED
|
||||
break
|
||||
|
||||
return status
|
||||
|
||||
Reference in New Issue
Block a user