54 lines
2.0 KiB
Python
54 lines
2.0 KiB
Python
from __future__ import annotations
|
|
|
|
from govoplan_core.core.module_guards import persistent_table_uninstall_guard
|
|
from govoplan_core.core.modules import DocumentationTopic, MigrationSpec, ModuleContext, ModuleManifest
|
|
from govoplan_core.core.organizations import CAPABILITY_ORGANIZATION_DIRECTORY
|
|
from govoplan_core.db.base import Base
|
|
from govoplan_organizations.backend.db import models as organization_models # noqa: F401 - populate metadata
|
|
|
|
|
|
def _organization_directory(context: ModuleContext) -> object:
|
|
del context
|
|
from govoplan_organizations.backend.directory import SqlOrganizationDirectory
|
|
|
|
return SqlOrganizationDirectory()
|
|
|
|
|
|
manifest = ModuleManifest(
|
|
id="organizations",
|
|
name="Organizations",
|
|
version="0.1.6",
|
|
dependencies=("tenancy",),
|
|
migration_spec=MigrationSpec(module_id="organizations", metadata=Base.metadata),
|
|
uninstall_guard_providers=(
|
|
persistent_table_uninstall_guard(
|
|
organization_models.OrganizationUnit,
|
|
organization_models.OrganizationFunction,
|
|
organization_models.OrganizationFunctionAssignment,
|
|
label="Organizations",
|
|
),
|
|
),
|
|
capability_factories={
|
|
CAPABILITY_ORGANIZATION_DIRECTORY: _organization_directory,
|
|
},
|
|
documentation=(
|
|
DocumentationTopic(
|
|
id="organizations.model",
|
|
title="Organization model",
|
|
summary="Organizations owns units, hierarchy, functions, and function assignments. Access maps those facts to roles and rights.",
|
|
body=(
|
|
"Use organization functions to model responsibilities that outlive people. "
|
|
"A function assignment can apply to one organization unit or to that unit and all subunits."
|
|
),
|
|
layer="configured",
|
|
documentation_types=("admin", "user"),
|
|
audience=("tenant_admin", "access_admin", "operator"),
|
|
order=25,
|
|
),
|
|
),
|
|
)
|
|
|
|
|
|
def get_manifest() -> ModuleManifest:
|
|
return manifest
|