diff --git a/CHANGELOG.md b/CHANGELOG.md index e5f3f48..e452b5e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,10 +20,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - For now removed features. ### Fixed -- For any bug fixes. +- Set default language when registering Documents or URLs. ### Security - In case of vulnerabilities. +- +## [1.0.6-alfa] - 2024-09-03 + +### Fixed +- Problems with tenant scheme migrations - may have to be revisited +- Correction of default language settings when uploading docs or URLs +- Addition of a CHANGELOG.md file ## [1.0.5-alfa] - 2024-09-02 diff --git a/common/models/README.txt b/common/models/README.txt new file mode 100644 index 0000000..14254a2 --- /dev/null +++ b/common/models/README.txt @@ -0,0 +1,2 @@ +If models are added to the public schema (i.e. in the user domain), ensure to add their corresponding tables to the +env.py, get_public_table_names, for tenant migrations! diff --git a/common/utils/document_utils.py b/common/utils/document_utils.py index 7a11fdb..9fcd661 100644 --- a/common/utils/document_utils.py +++ b/common/utils/document_utils.py @@ -5,6 +5,7 @@ from common.models.document import Document, DocumentVersion from common.extensions import db, minio_client from common.utils.celery_utils import current_celery from flask import current_app +from flask_security import current_user import requests from urllib.parse import urlparse, unquote import os @@ -109,10 +110,30 @@ def set_logging_information(obj, timestamp): obj.created_at = timestamp obj.updated_at = timestamp + user_id = get_current_user_id() + if user_id: + obj.created_by = user_id + obj.updated_by = user_id + def update_logging_information(obj, timestamp): obj.updated_at = timestamp + user_id = get_current_user_id() + if user_id: + obj.updated_by = user_id + + +def get_current_user_id(): + try: + if current_user and current_user.is_authenticated: + return current_user.id + else: + return None + except Exception: + # This will catch any errors if current_user is not available (e.g., in API context) + return None + def get_extension_from_content_type(content_type): content_type_map = { diff --git a/eveai_app/templates/user/tenant_overview.html b/eveai_app/templates/user/tenant_overview.html index 2a63ca5..da08a38 100644 --- a/eveai_app/templates/user/tenant_overview.html +++ b/eveai_app/templates/user/tenant_overview.html @@ -80,7 +80,7 @@