feat: scaffold governed wiki module
This commit is contained in:
@@ -0,0 +1,134 @@
|
||||
from __future__ import annotations
|
||||
|
||||
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,
|
||||
)
|
||||
|
||||
|
||||
MODULE_ID = "wiki"
|
||||
MODULE_NAME = "Wiki"
|
||||
MODULE_VERSION = "0.1.14"
|
||||
READ_SCOPE = "wiki:page:read"
|
||||
WRITE_SCOPE = "wiki:page:write"
|
||||
ADMIN_SCOPE = "wiki:space:admin"
|
||||
OPTIONAL_DEPENDENCIES = (
|
||||
"files",
|
||||
"dms",
|
||||
"records",
|
||||
"search",
|
||||
"workflow",
|
||||
"tasks",
|
||||
"projects",
|
||||
"cases",
|
||||
"templates",
|
||||
"notifications",
|
||||
)
|
||||
|
||||
|
||||
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=MODULE_NAME,
|
||||
level="tenant",
|
||||
module_id=module_id,
|
||||
resource=resource,
|
||||
action=action,
|
||||
)
|
||||
|
||||
|
||||
PERMISSIONS = (
|
||||
_permission(READ_SCOPE, "Read Wiki pages", "Discover and read accessible Wiki pages."),
|
||||
_permission(WRITE_SCOPE, "Edit Wiki pages", "Create and revise pages in writable spaces."),
|
||||
_permission(ADMIN_SCOPE, "Administer Wiki spaces", "Configure spaces, publishing, and access."),
|
||||
)
|
||||
|
||||
ROLE_TEMPLATES = (
|
||||
RoleTemplate(
|
||||
slug="wiki_editor",
|
||||
name="Wiki editor",
|
||||
description="Read and revise Wiki pages.",
|
||||
permissions=(READ_SCOPE, WRITE_SCOPE),
|
||||
),
|
||||
RoleTemplate(
|
||||
slug="wiki_reader",
|
||||
name="Wiki reader",
|
||||
description="Read accessible Wiki pages.",
|
||||
permissions=(READ_SCOPE,),
|
||||
),
|
||||
)
|
||||
|
||||
DOCUMENTATION = (
|
||||
DocumentationTopic(
|
||||
id="wiki.module-boundary",
|
||||
title="Wiki module boundary",
|
||||
summary=(
|
||||
"Collaborative knowledge spaces, pages, revisions, links, labels, "
|
||||
"access, and publishing."
|
||||
),
|
||||
body=(
|
||||
"Wiki owns revisioned knowledge pages. Files/DMS owns binary "
|
||||
"attachments, Records owns formal retention, and connectors own "
|
||||
"MediaWiki/BlueSpice synchronization."
|
||||
),
|
||||
layer="available",
|
||||
documentation_types=("admin",),
|
||||
audience=("operator", "module_admin", "product_owner"),
|
||||
related_modules=OPTIONAL_DEPENDENCIES,
|
||||
links=(
|
||||
DocumentationLink(
|
||||
label="Repository domain boundary",
|
||||
href="govoplan-wiki/docs/WIKI_DOMAIN_BOUNDARY.md",
|
||||
kind="repository",
|
||||
),
|
||||
),
|
||||
metadata={
|
||||
"seed": True,
|
||||
"domain_objects": [
|
||||
"wiki space",
|
||||
"wiki page",
|
||||
"page revision",
|
||||
"page link",
|
||||
"page label",
|
||||
"publishing state",
|
||||
],
|
||||
"first_slice": (
|
||||
"Implement spaces, revisioned pages, links, access checks, "
|
||||
"and permission-aware search publication."
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
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,
|
||||
)
|
||||
|
||||
|
||||
def get_manifest() -> ModuleManifest:
|
||||
return manifest
|
||||
Reference in New Issue
Block a user