Files
govoplan-ops/src/govoplan_ops/backend/manifest.py
T

84 lines
2.9 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 FrontendModule, FrontendRoute, ModuleContext, ModuleManifest, NavItem, PermissionDefinition, RoleTemplate
from govoplan_core.core.views import ViewSurface
OPS_READ_SCOPE = "ops:operations:read"
OPS_READ_SCOPES = (OPS_READ_SCOPE, "system:settings:read", "admin:settings:read")
OPS_RUN_SCOPE = "ops:operations:run"
OPS_RUN_SCOPES = (OPS_RUN_SCOPE, "system:settings:write")
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="Operations",
level="system",
module_id=module_id,
resource=resource,
action=action,
)
def _route_factory(context: ModuleContext):
del context
from govoplan_ops.backend.api.v1.routes import router
return router
manifest = ModuleManifest(
id="ops",
name="Ops",
version="0.1.8",
required_capabilities=(CAPABILITY_AUTH_PRINCIPAL_RESOLVER, CAPABILITY_AUTH_PERMISSION_EVALUATOR),
optional_dependencies=("audit", "docs", "notifications"),
permissions=(
_permission(
OPS_READ_SCOPE,
"View operations status",
"Read runtime health, deployment profile, and sizing information.",
),
_permission(
OPS_RUN_SCOPE,
"Run operational checks",
"Run bounded module-owned persistence and integration probes.",
),
),
role_templates=(
RoleTemplate(
slug="ops_reader",
name="Operations reader",
description="Read platform health and deployment profile information.",
permissions=(OPS_READ_SCOPE,),
level="system",
),
RoleTemplate(
slug="ops_operator",
name="Operations operator",
description="Read platform health and run bounded operational probes.",
permissions=(OPS_READ_SCOPE, OPS_RUN_SCOPE),
level="system",
),
),
route_factory=_route_factory,
nav_items=(NavItem(path="/ops", label="Ops", icon="activity", required_any=OPS_READ_SCOPES, order=890),),
frontend=FrontendModule(
module_id="ops",
package_name="@govoplan/ops-webui",
routes=(FrontendRoute(path="/ops", component="OpsPage", required_any=OPS_READ_SCOPES, order=890),),
nav_items=(NavItem(path="/ops", label="Ops", icon="activity", required_any=OPS_READ_SCOPES, order=890),),
view_surfaces=(
ViewSurface(id="ops.widget.health", module_id="ops", kind="section", label="Operations health widget", order=100),
),
),
)
def get_manifest() -> ModuleManifest:
return manifest