48 lines
1.2 KiB
Python
48 lines
1.2 KiB
Python
from __future__ import annotations
|
|
|
|
from govoplan_core.core.access import (
|
|
CAPABILITY_AUTH_PERMISSION_EVALUATOR,
|
|
CAPABILITY_AUTH_PRINCIPAL_RESOLVER,
|
|
CAPABILITY_AUTH_TENANT_CONTEXT_SWITCHER,
|
|
CAPABILITY_TENANCY_TENANT_RESOLVER,
|
|
)
|
|
from govoplan_core.core.modules import ModuleContext, ModuleManifest
|
|
|
|
|
|
def _tenant_resolver(context: ModuleContext):
|
|
del context
|
|
from govoplan_tenancy.backend.capabilities import SqlTenantResolver
|
|
|
|
return SqlTenantResolver()
|
|
|
|
|
|
def _route_factory(context: ModuleContext):
|
|
del context
|
|
from fastapi import APIRouter
|
|
from govoplan_tenancy.backend.api.v1.routes import router, tenant_router
|
|
|
|
aggregate = APIRouter()
|
|
aggregate.include_router(router)
|
|
aggregate.include_router(tenant_router)
|
|
return aggregate
|
|
|
|
|
|
manifest = ModuleManifest(
|
|
id="tenancy",
|
|
name="Tenancy",
|
|
version="0.1.7",
|
|
required_capabilities=(
|
|
CAPABILITY_AUTH_PRINCIPAL_RESOLVER,
|
|
CAPABILITY_AUTH_PERMISSION_EVALUATOR,
|
|
CAPABILITY_AUTH_TENANT_CONTEXT_SWITCHER,
|
|
),
|
|
route_factory=_route_factory,
|
|
capability_factories={
|
|
CAPABILITY_TENANCY_TENANT_RESOLVER: _tenant_resolver,
|
|
},
|
|
)
|
|
|
|
|
|
def get_manifest() -> ModuleManifest:
|
|
return manifest
|