58 lines
1.8 KiB
Python
58 lines
1.8 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 ModuleContext, ModuleInterfaceProvider, ModuleManifest, PermissionDefinition, RoleTemplate
|
|
|
|
SOAP_READ_SCOPE = "soap:endpoint:read"
|
|
SOAP_READ_SCOPES = (SOAP_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="SOAP connector",
|
|
level="system",
|
|
module_id=module_id,
|
|
resource=resource,
|
|
action=action,
|
|
)
|
|
|
|
|
|
def _route_factory(context: ModuleContext):
|
|
del context
|
|
from govoplan_soap.backend.router import router
|
|
|
|
return router
|
|
|
|
|
|
manifest = ModuleManifest(
|
|
id="soap",
|
|
name="SOAP Connector",
|
|
version="0.1.7",
|
|
required_capabilities=(CAPABILITY_AUTH_PRINCIPAL_RESOLVER, CAPABILITY_AUTH_PERMISSION_EVALUATOR),
|
|
optional_dependencies=("audit", "docs", "policy"),
|
|
provides_interfaces=(
|
|
ModuleInterfaceProvider(name="soap.operationPublication", version="0.1.0"),
|
|
),
|
|
permissions=(
|
|
_permission(SOAP_READ_SCOPE, "View SOAP connector", "Read SOAP connector status and published operation metadata."),
|
|
),
|
|
role_templates=(
|
|
RoleTemplate(
|
|
slug="soap_connector_reader",
|
|
name="SOAP connector reader",
|
|
description="Read SOAP connector diagnostics and published operation metadata.",
|
|
permissions=(SOAP_READ_SCOPE,),
|
|
level="system",
|
|
),
|
|
),
|
|
route_factory=_route_factory,
|
|
)
|
|
|
|
|
|
def get_manifest() -> ModuleManifest:
|
|
return manifest
|