132 lines
5.2 KiB
Python
132 lines
5.2 KiB
Python
from __future__ import annotations
|
|
|
|
from govoplan_core.core.modules import with_documentation_structured_translations
|
|
from govoplan_permits.backend.german_structured_documentation import GERMAN_STRUCTURED_TRANSLATIONS
|
|
|
|
from govoplan_core.core.access import CAPABILITY_AUTH_PERMISSION_EVALUATOR, CAPABILITY_AUTH_PRINCIPAL_RESOLVER
|
|
from govoplan_core.core.modules import DocumentationLink, DocumentationTopic, ModuleManifest, PermissionDefinition, RoleTemplate
|
|
from govoplan_core.core.provider_governance import declared_module_architecture
|
|
|
|
MODULE_ID = "permits"
|
|
MODULE_NAME = "Permits"
|
|
MODULE_VERSION = "0.1.20"
|
|
READ_SCOPE = "permits:workspace:read"
|
|
WRITE_SCOPE = "permits:workspace:write"
|
|
ADMIN_SCOPE = "permits:workspace:admin"
|
|
OPTIONAL_DEPENDENCIES = (
|
|
"cases",
|
|
"inspections",
|
|
"forms_runtime",
|
|
"files",
|
|
"portal",
|
|
"certificates",
|
|
"records",
|
|
)
|
|
|
|
|
|
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="Permits",
|
|
level="tenant",
|
|
module_id=module_id,
|
|
resource=resource,
|
|
action=action,
|
|
)
|
|
|
|
|
|
PERMISSIONS = (
|
|
_permission(READ_SCOPE, "View permits workspace", "Read permits records, configuration, and workflow context."),
|
|
_permission(WRITE_SCOPE, "Manage permits workspace", "Create and update permits records and workflow state."),
|
|
_permission(ADMIN_SCOPE, "Administer permits workspace", "Configure permits policies, templates, and tenant-level administration."),
|
|
)
|
|
|
|
ROLE_TEMPLATES = (
|
|
RoleTemplate(
|
|
slug="permits_manager",
|
|
name="Permits manager",
|
|
description="Manage permits records and workflow state.",
|
|
permissions=(READ_SCOPE, WRITE_SCOPE),
|
|
),
|
|
RoleTemplate(
|
|
slug="permits_viewer",
|
|
name="Permits viewer",
|
|
description="Read permits records and workflow context.",
|
|
permissions=(READ_SCOPE,),
|
|
),
|
|
)
|
|
|
|
DOCUMENTATION = (
|
|
DocumentationTopic(
|
|
id=f"{MODULE_ID}.module-boundary",
|
|
title=f"{MODULE_NAME} module boundary",
|
|
summary="Permit and license workflows for applications, renewals, conditions, inspections, objections, revocations, and compliance evidence.",
|
|
body=(
|
|
"This repository is currently a platform module seed. It registers the domain boundary, "
|
|
"permission surface, role templates, and documentation metadata before runtime APIs, "
|
|
"database models, migrations, and WebUI routes are introduced."
|
|
),
|
|
layer="available",
|
|
documentation_types=("admin", "user"),
|
|
audience=("user", "operator", "module_admin", "product_owner"),
|
|
translations={
|
|
"de": {
|
|
"title": "Modulgrenze von Permits",
|
|
"summary": "Erlaubnis- und Lizenzverfahren für Anträge, Verlängerungen, Auflagen, Prüfungen, Widersprüche, Widerrufe und Compliance-Nachweise.",
|
|
"body": "Dieses Repository ist derzeit ein Grundgerüst für ein Plattformmodul. Es registriert die Fachgrenze, Berechtigungsoberfläche, Rollenvorlagen und Dokumentationsmetadaten, bevor Laufzeit-APIs, Datenbankmodelle, Migrationen und WebUI-Routen eingeführt werden.",
|
|
}
|
|
},
|
|
order=100,
|
|
related_modules=OPTIONAL_DEPENDENCIES,
|
|
links=(
|
|
DocumentationLink(
|
|
label="Repository domain boundary",
|
|
href="govoplan-permits/docs/PERMITS_DOMAIN_BOUNDARY.md",
|
|
kind="repository",
|
|
),
|
|
),
|
|
metadata={
|
|
"kind": "reference",
|
|
"seed": True,
|
|
"consequence_classes": {
|
|
"seed_boundary": "Declares ownership and permissions only; no runtime workflow is available yet.",
|
|
},
|
|
"domain_objects": ['permit application lifecycle', 'license and permit records', 'conditions', 'renewals', 'objections', 'revocation state', 'inspection handoffs'],
|
|
"first_slice": "Define permit type, application, decision, condition, renewal, objection, revocation, and inspection link records.",
|
|
},
|
|
),
|
|
)
|
|
|
|
manifest = ModuleManifest(
|
|
id=MODULE_ID,
|
|
name=MODULE_NAME,
|
|
version=MODULE_VERSION,
|
|
dependencies=("access",),
|
|
optional_dependencies=OPTIONAL_DEPENDENCIES,
|
|
required_capabilities=(CAPABILITY_AUTH_PRINCIPAL_RESOLVER, CAPABILITY_AUTH_PERMISSION_EVALUATOR),
|
|
permissions=PERMISSIONS,
|
|
role_templates=ROLE_TEMPLATES,
|
|
documentation=DOCUMENTATION,
|
|
architecture=declared_module_architecture(
|
|
layer="domain_capability",
|
|
kind="domain",
|
|
maturity="scaffold",
|
|
documentation_ref="docs/PERMITS_DOMAIN_BOUNDARY.md",
|
|
known_limits=("Permit application, assessment, decision, and validity lifecycles are not implemented yet.",),
|
|
owned_concepts=("permit", "permit application", "permit condition"),
|
|
non_owned_concepts=("case", "formal decision", "payment"),
|
|
),
|
|
)
|
|
|
|
|
|
manifest = with_documentation_structured_translations(
|
|
manifest, locale="de", translations=GERMAN_STRUCTURED_TRANSLATIONS
|
|
)
|
|
|
|
|
|
def get_manifest() -> ModuleManifest:
|
|
return manifest
|