95 lines
4.4 KiB
Python
95 lines
4.4 KiB
Python
from __future__ import annotations
|
|
|
|
from govoplan_core.core.access import CAPABILITY_AUTH_PERMISSION_EVALUATOR, CAPABILITY_AUTH_PRINCIPAL_RESOLVER
|
|
from govoplan_core.core.modules import DocumentationTopic, ModuleContext, ModuleInterfaceProvider, ModuleManifest, PermissionDefinition, RoleTemplate
|
|
from govoplan_core.core.provider_governance import declared_module_architecture
|
|
|
|
REST_READ_SCOPE = "rest:endpoint:read"
|
|
REST_READ_SCOPES = (REST_READ_SCOPE, "system:settings:read", "admin:settings:read")
|
|
|
|
|
|
def _permission(scope: str, label: str, description: str) -> PermissionDefinition:
|
|
module_id, resource, action = scope.split(":", 2)
|
|
return PermissionDefinition(
|
|
scope=scope,
|
|
label=label,
|
|
description=description,
|
|
category="REST connector",
|
|
level="system",
|
|
module_id=module_id,
|
|
resource=resource,
|
|
action=action,
|
|
)
|
|
|
|
|
|
def _route_factory(context: ModuleContext):
|
|
del context
|
|
from govoplan_rest.backend.router import router
|
|
|
|
return router
|
|
|
|
|
|
manifest = ModuleManifest(
|
|
id="rest",
|
|
name="REST Connector",
|
|
version="0.1.19",
|
|
required_capabilities=(CAPABILITY_AUTH_PRINCIPAL_RESOLVER, CAPABILITY_AUTH_PERMISSION_EVALUATOR),
|
|
optional_dependencies=("audit", "docs", "policy"),
|
|
provides_interfaces=(
|
|
ModuleInterfaceProvider(name="rest.function_publication", version="0.1.0"),
|
|
),
|
|
permissions=(
|
|
_permission(REST_READ_SCOPE, "View REST connector", "Read REST connector status and published function metadata."),
|
|
),
|
|
role_templates=(
|
|
RoleTemplate(
|
|
slug="rest_connector_reader",
|
|
name="REST connector reader",
|
|
description="Read REST connector diagnostics and published endpoint metadata.",
|
|
permissions=(REST_READ_SCOPE,),
|
|
level="system",
|
|
),
|
|
),
|
|
documentation=(
|
|
DocumentationTopic(
|
|
id="rest.published-function-boundary",
|
|
title="Use governed REST publications",
|
|
summary="REST exposes explicitly published module functions through a transport adapter without taking ownership of their business behavior.",
|
|
body="Only functions registered through the publication contract are discoverable. The source module still owns validation, authorization facts, idempotency, and side effects; REST owns HTTP binding, serialization, transport policy, throttling, and diagnostics. The current surface is a provider contract and discovery API, not an unrestricted proxy to internal endpoints.",
|
|
documentation_types=("admin", "user"),
|
|
audience=("integration_user", "operator", "module_admin"),
|
|
related_modules=("policy", "audit", "docs"),
|
|
translations={
|
|
"de": {
|
|
"title": "Gesteuerte REST-Veröffentlichungen verwenden",
|
|
"summary": "REST stellt ausdrücklich veröffentlichte Modulfunktionen über einen Transportadapter bereit, ohne deren fachliches Verhalten zu übernehmen.",
|
|
"body": (
|
|
"Nur Funktionen, die über den Veröffentlichungsvertrag registriert sind, können gefunden werden. "
|
|
"Das Quellmodul bleibt für Validierung, Autorisierungsfakten, Idempotenz und Seiteneffekte verantwortlich; "
|
|
"REST verantwortet HTTP-Bindung, Serialisierung, Transportrichtlinien, Drosselung und Diagnostik. "
|
|
"Die aktuelle Oberfläche ist ein Anbieter- und Ermittlungsvertrag und kein unbeschränkter Proxy für interne Endpunkte."
|
|
),
|
|
}
|
|
},
|
|
metadata={"kind": "reference"},
|
|
),
|
|
),
|
|
route_factory=_route_factory,
|
|
architecture=declared_module_architecture(
|
|
layer="data_reporting_integration",
|
|
kind="integration",
|
|
maturity="vertical_slice",
|
|
documentation_ref="README.md",
|
|
test_ref="tests/test_rest_module_contract.py",
|
|
known_limits=("Only governed function discovery/publication contracts are implemented; arbitrary endpoint proxying is excluded.",),
|
|
supported_authority_modes=("governance_overlay", "linked_reference"),
|
|
owned_concepts=("REST transport binding", "HTTP serialization", "transport diagnostics"),
|
|
non_owned_concepts=("published business function", "domain authorization", "domain effect"),
|
|
security_docs=("README.md",),
|
|
),
|
|
)
|
|
|
|
|
|
def get_manifest() -> ModuleManifest:
|
|
return manifest
|