Initialize Poll module seed
This commit is contained in:
94
src/govoplan_poll/backend/manifest.py
Normal file
94
src/govoplan_poll/backend/manifest.py
Normal file
@@ -0,0 +1,94 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from govoplan_core.core.access import CAPABILITY_AUTH_PERMISSION_EVALUATOR, CAPABILITY_AUTH_PRINCIPAL_RESOLVER
|
||||
from govoplan_core.core.modules import (
|
||||
DocumentationTopic,
|
||||
ModuleInterfaceProvider,
|
||||
ModuleManifest,
|
||||
PermissionDefinition,
|
||||
RoleTemplate,
|
||||
)
|
||||
|
||||
MODULE_ID = "poll"
|
||||
MODULE_NAME = "Poll"
|
||||
MODULE_VERSION = "0.1.8"
|
||||
READ_SCOPE = "poll:poll:read"
|
||||
WRITE_SCOPE = "poll:poll:write"
|
||||
ADMIN_SCOPE = "poll:poll:admin"
|
||||
RESPOND_SCOPE = "poll:response: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="Poll",
|
||||
level="tenant",
|
||||
module_id=module_id,
|
||||
resource=resource,
|
||||
action=action,
|
||||
)
|
||||
|
||||
|
||||
PERMISSIONS = (
|
||||
_permission(READ_SCOPE, "View polls", "Read poll definitions, invitations, responses, and result summaries."),
|
||||
_permission(WRITE_SCOPE, "Manage polls", "Create, edit, close, reopen, and decide polls."),
|
||||
_permission(ADMIN_SCOPE, "Administer polls", "Configure tenant-level polling policies and visibility defaults."),
|
||||
_permission(RESPOND_SCOPE, "Respond to polls", "Submit and update own poll responses where policy allows it."),
|
||||
)
|
||||
|
||||
ROLE_TEMPLATES = (
|
||||
RoleTemplate(
|
||||
slug="poll_manager",
|
||||
name="Poll manager",
|
||||
description="Create, manage, close, and decide polls.",
|
||||
permissions=(READ_SCOPE, WRITE_SCOPE, RESPOND_SCOPE),
|
||||
),
|
||||
RoleTemplate(
|
||||
slug="poll_participant",
|
||||
name="Poll participant",
|
||||
description="Read assigned polls and submit own responses.",
|
||||
permissions=(READ_SCOPE, RESPOND_SCOPE),
|
||||
),
|
||||
)
|
||||
|
||||
DOCUMENTATION = (
|
||||
DocumentationTopic(
|
||||
id="poll.module-boundary",
|
||||
title="Poll module boundary",
|
||||
summary="Lightweight decision and availability polls for reusable module integrations.",
|
||||
body=(
|
||||
"Poll owns reusable poll definitions, options, invitations, responses, visibility rules, "
|
||||
"closing semantics, and result summaries. Scheduling consumes Poll for availability "
|
||||
"matrices, while Evaluation owns heavier surveys, scoring, rubrics, and analytics."
|
||||
),
|
||||
layer="available",
|
||||
documentation_types=("admin",),
|
||||
audience=("operator", "module_admin", "product_owner"),
|
||||
related_modules=("scheduling", "evaluation", "calendar", "campaigns", "portal"),
|
||||
metadata={"seed": True},
|
||||
),
|
||||
)
|
||||
|
||||
manifest = ModuleManifest(
|
||||
id=MODULE_ID,
|
||||
name=MODULE_NAME,
|
||||
version=MODULE_VERSION,
|
||||
dependencies=("access",),
|
||||
optional_dependencies=("calendar", "campaigns", "portal", "mail", "notifications", "forms-runtime"),
|
||||
required_capabilities=(CAPABILITY_AUTH_PRINCIPAL_RESOLVER, CAPABILITY_AUTH_PERMISSION_EVALUATOR),
|
||||
provides_interfaces=(
|
||||
ModuleInterfaceProvider(name="poll.option_selection", version="0.1.8"),
|
||||
ModuleInterfaceProvider(name="poll.availability_matrix", version="0.1.8"),
|
||||
ModuleInterfaceProvider(name="poll.response_collection", version="0.1.8"),
|
||||
),
|
||||
permissions=PERMISSIONS,
|
||||
role_templates=ROLE_TEMPLATES,
|
||||
documentation=DOCUMENTATION,
|
||||
)
|
||||
|
||||
|
||||
def get_manifest() -> ModuleManifest:
|
||||
return manifest
|
||||
Reference in New Issue
Block a user