- Consent giving UI introduced

- Possibility to view the document version the consent is given to
- Blocking functionality is no valid consent
This commit is contained in:
Josako
2025-10-15 18:35:28 +02:00
parent 3ea3a06de6
commit eeb76d57b7
22 changed files with 803 additions and 126 deletions

View File

@@ -117,7 +117,10 @@ def is_exempt_endpoint(endpoint: str) -> bool:
'user_bp.no_consent',
'user_bp.tenant_consent_renewal',
'user_bp.consent_renewal',
'security_bp.consent_sign',
'user_bp.view_tenant_consents',
'user_bp.accept_tenant_consent',
'user_bp.view_consent_markdown',
'basic_bp.view_content',
}
default_prefixes = [
'security_bp.',
@@ -160,7 +163,18 @@ def enforce_tenant_consent_ui():
if not tenant_id:
return redirect(prefixed_url_for('security_bp.login', for_redirect=True))
status = session.get('consent_status', ConsentStatus.NOT_CONSENTED)
raw_status = session.get('consent_status', ConsentStatus.NOT_CONSENTED)
# Coerce string to ConsentStatus enum if needed
status = raw_status
try:
if isinstance(raw_status, str):
# Accept formats like 'CONSENTED' or 'ConsentStatus.CONSENTED'
name = raw_status.split('.')[-1]
from common.models.user import ConsentStatus as CS
status = getattr(CS, name, CS.NOT_CONSENTED)
except Exception:
status = ConsentStatus.NOT_CONSENTED
if status == ConsentStatus.CONSENTED:
current_app.logger.debug('User has consented')
return None