Phase 0 Complete: Tasks 0.7-0.20

- 0.7: UI-Design-Richtlinien (docs/ui-design-guidelines.md, 535 lines)
- 0.8: Theme-Customization Backend (4 theme fields, migration 0023)
- 0.9: Theme-Customization Frontend (SettingsTheme.tsx, themeStore.ts, live preview)
- 0.10: RBAC-Audit (4 plugins secured, 53 routes with require_permission)
- 0.11: LiteLLM-Cleanup (llm_client.py migrated from httpx to litellm)
- 0.12: KI-Agent-Framework docs (plugin-development-guide.md, agent_capabilities field)
- 0.13: Heartbeat configurable (ProactiveSettings, migration 0024, frontend UI)
- 0.14: Unified Search Field-Level RBAC (resolve_permissions + filter_fields_by_permission)
- 0.15: Undo/History-System (EntityHistory model, service, routes, migration 0025, HistoryViewer)
- 0.16: Storage Backend (LocalStorage + S3Storage, DMS/attachments/mail updated)
- 0.17: Import/Export unified Contact fields (firstname, surname, email_1, phone_1)
- 0.18: .gitignore & Config-Cleanup (webui→frontend, python-jose removed, .env untracked)
- 0.19: Mail-Salt Security-Fix (per-account random salt, migration 0026)
- 0.20: AGPL replaced (PyMuPDF→pypdf, OnlyOffice→Collabora, LICENSE + THIRD_PARTY_LICENSES.md)
This commit is contained in:
Agent Zero
2026-07-23 08:42:26 +02:00
parent 3d06cb2353
commit ec81940178
65 changed files with 3061 additions and 277 deletions
+6 -12
View File
@@ -11,11 +11,9 @@ from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession
from app.core.audit import log_audit
from app.core.storage import get_storage_backend
from app.models.attachment import Attachment
# Storage path for uploaded files
STORAGE_PATH = os.environ.get("STORAGE_PATH", "/data/uploads")
def _attachment_to_dict(a: Attachment) -> dict[str, Any]:
"""Serialize an Attachment ORM object to dict."""
@@ -50,17 +48,13 @@ async def save_attachment(
mime_type: str,
) -> dict[str, Any]:
"""Save a file to storage and create an Attachment record."""
# Ensure storage directory exists
entity_dir = os.path.join(STORAGE_PATH, entity_type, str(entity_id))
os.makedirs(entity_dir, exist_ok=True)
# Generate unique filename
# Generate unique filename and relative storage path
unique_filename = _generate_unique_filename(filename)
file_path = os.path.join(entity_dir, unique_filename)
file_path = f"{entity_type}/{entity_id}/{unique_filename}"
# Write file to disk
with open(file_path, "wb") as f:
f.write(file_content)
# Save file via storage backend
storage = get_storage_backend()
await storage.save(file_path, file_content)
file_size = len(file_content)