- Check for consent before allowing users to perform activities in the administrative app.
This commit is contained in:
@@ -6,7 +6,6 @@ from sqlalchemy.exc import SQLAlchemyError
|
||||
from common.models.entitlements import PartnerServiceLicenseTier
|
||||
from common.utils.eveai_exceptions import EveAINoManagementPartnerService, EveAINoSessionPartner
|
||||
|
||||
from common.utils.security_utils import current_user_has_role
|
||||
|
||||
|
||||
class PartnerServices:
|
||||
|
||||
@@ -11,7 +11,6 @@ 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
|
||||
|
||||
from common.utils.security_utils import current_user_has_role
|
||||
|
||||
|
||||
class TenantServices:
|
||||
@@ -201,3 +200,29 @@ class TenantServices:
|
||||
break
|
||||
|
||||
return status
|
||||
|
||||
@staticmethod
|
||||
def get_consent_status_details(tenant_id: int) -> Dict[str, str]:
|
||||
cts = current_app.config.get("CONSENT_TYPES")
|
||||
details = {}
|
||||
for ct in cts:
|
||||
ct = cv.consent_type
|
||||
consent = (TenantConsent.query.filter_by(tenant_id=tenant_id, consent_type=ct)
|
||||
.order_by(desc(TenantConsent.id))
|
||||
.first())
|
||||
if not consent:
|
||||
details[ct] = {
|
||||
'status': str(ConsentStatus.NOT_CONSENTED),
|
||||
'version': str(cv.consent_version)
|
||||
}
|
||||
continue
|
||||
if cv.consent_valid_to.date >= dt.now(tz.utc).date():
|
||||
details[ct] = {
|
||||
'status': str(ConsentStatus.RENEWAL_REQUIRED),
|
||||
'version': str(cv.consent_version)
|
||||
}
|
||||
|
||||
details[ct] = {
|
||||
'status': str(ConsentStatus.CONSENTED),
|
||||
'version': str(cv.consent_version)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user