Initialize GovOPlaN REST connector

This commit is contained in:
2026-07-11 17:17:03 +02:00
commit ada9f843eb
10 changed files with 226 additions and 0 deletions

View File

@@ -0,0 +1,57 @@
from __future__ import annotations
from govoplan_core.core.access import CAPABILITY_AUTH_PERMISSION_EVALUATOR, CAPABILITY_AUTH_PRINCIPAL_RESOLVER
from govoplan_core.core.modules import ModuleContext, ModuleInterfaceProvider, ModuleManifest, PermissionDefinition, RoleTemplate
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.7",
required_capabilities=(CAPABILITY_AUTH_PRINCIPAL_RESOLVER, CAPABILITY_AUTH_PERMISSION_EVALUATOR),
optional_dependencies=("audit", "docs", "policy"),
provides_interfaces=(
ModuleInterfaceProvider(name="rest.functionPublication", 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",
),
),
route_factory=_route_factory,
)
def get_manifest() -> ModuleManifest:
return manifest