c25356c257
Check Cross-Plugin Imports / check (push) Has been cancelled
- workspace_scopes() Contract-Hook (document_placeholders-Muster): Plugins deklarieren Scope-Dimensionen inkl. Wertequellen
- Deklarationen: contacts (Ordner/Typen/Saved-View), dms (Ordner/Datei-Typen), mail (Postfächer), calendar (Kalender/Standard-Ansicht)
- Pydantic fail-closed (schemas/workspace.py): ScopeOption, ScopeValueSource (nur interne /api/v1-Pfade, SSRF-sicher), WorkspaceScopeDimension, WorkspaceModuleScopes
- Aggregator workspace_scope_service.py: discovered-Plugins, ARCH-014-safe, Crash-sicher, ungültige Deklarationen verworfen
- GET /api/v1/workspaces/scope-definitions (workspaces:configure_modules) vor /{workspace_id} registriert
- Security-Invariante: Scope = reine UND-Einschränkung (Workspace ∧ RLS ∧ ABAC ∧ Permissions)
- Tests: 18/18 neu (TDD rot→grün), Regression 17/17, Checker 0 Verstöße, Ruff clean
- Doku: api-documentation.md Workspaces-Sektion, PROGRESS.md Phase N1
75 lines
2.3 KiB
Python
75 lines
2.3 KiB
Python
"""DMS plugin contract — public interface for cross-plugin access."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from app.plugins.builtins.contracts import get_contract_registry
|
|
from app.plugins.builtins.dms.models import File as DmsFile
|
|
from app.plugins.builtins.dms.models import Folder
|
|
|
|
|
|
class DmsContract:
|
|
"""Public contract for the DMS plugin."""
|
|
|
|
contract_name = "dms"
|
|
|
|
DmsFile = DmsFile
|
|
Folder = Folder
|
|
|
|
@staticmethod
|
|
def workspace_scopes() -> list[dict]:
|
|
"""Scope-Dimensionen des dms-Moduls für den Workspace-Editor (N1)."""
|
|
return [
|
|
{
|
|
"module_key": "dms",
|
|
"dimensions": [
|
|
{
|
|
"key": "folder_ids",
|
|
"label": "DMS-Ordner",
|
|
"control": "multiselect",
|
|
"value_source": {
|
|
"endpoint": "/api/v1/dms/folders",
|
|
"items_path": "",
|
|
"value_key": "id",
|
|
"label_key": "name",
|
|
},
|
|
},
|
|
{
|
|
"key": "file_types",
|
|
"label": "Datei-Typen",
|
|
"control": "multiselect",
|
|
"options": [
|
|
{"value": "application/pdf", "label": "PDF"},
|
|
{"value": "image/", "label": "Bilder"},
|
|
{"value": "spreadsheet", "label": "Tabellen"},
|
|
{"value": "word", "label": "Dokumente"},
|
|
{"value": "other", "label": "Sonstige"},
|
|
],
|
|
},
|
|
],
|
|
}
|
|
]
|
|
|
|
@classmethod
|
|
def get_function(cls, name: str):
|
|
"""Return a callable exposed by this contract, or None if absent."""
|
|
return getattr(cls, name, None)
|
|
|
|
|
|
# ─── self-registration ───
|
|
|
|
_contract = DmsContract()
|
|
get_contract_registry().register("dms", _contract)
|
|
|
|
# Backward-compatible local accessor
|
|
_contract_instance: DmsContract | None = None
|
|
|
|
|
|
def get_contract() -> DmsContract:
|
|
global _contract_instance
|
|
if _contract_instance is None:
|
|
_contract_instance = DmsContract()
|
|
return _contract_instance
|
|
|
|
|
|
__all__ = ["DmsContract", "DmsFile", "Folder"]
|