54 lines
3.4 KiB
TypeScript
54 lines
3.4 KiB
TypeScript
import { createElement, lazy } from "react";
|
|
import type { ActingContextRuntimeUiCapability, PlatformRouteContext, PlatformWebModule } from "@govoplan/core-webui";
|
|
import { adminReadScopes } from "@govoplan/core-webui";
|
|
import ActingContextSelector from "./features/acting-context/ActingContextSelector";
|
|
import { generatedTranslations } from "./i18n/generatedTranslations";
|
|
|
|
const AdminPage = lazy(() => import("./features/admin/AdminPage"));
|
|
|
|
const translations = {
|
|
en: generatedTranslations.en,
|
|
de: generatedTranslations.de
|
|
};
|
|
|
|
const accessAdminSurfaces = [
|
|
{ id: "access.admin.system-roles", moduleId: "access", kind: "section" as const, label: "i18n:govoplan-access.system_roles.a9461aa6", order: 20 },
|
|
{ id: "access.admin.system-users", moduleId: "access", kind: "section" as const, label: "i18n:govoplan-access.central_users.91ac1b51", order: 50 },
|
|
{ id: "access.admin.system-credentials", moduleId: "access", kind: "section" as const, label: "i18n:govoplan-access.system_credentials.4af2c023", order: 80 },
|
|
{ id: "access.admin.tenant-roles", moduleId: "access", kind: "section" as const, label: "i18n:govoplan-access.tenant_roles.51aca82d", order: 10 },
|
|
{ id: "access.admin.tenant-function-mappings", moduleId: "access", kind: "section" as const, label: "i18n:govoplan-access.function_role_mappings.2b64e9c3", order: 20 },
|
|
{ id: "access.admin.tenant-groups", moduleId: "access", kind: "section" as const, label: "i18n:govoplan-access.tenant_groups.47e6cc05", order: 30 },
|
|
{ id: "access.admin.tenant-users", moduleId: "access", kind: "section" as const, label: "i18n:govoplan-access.tenant_users.cb800b38", order: 40 },
|
|
{ id: "access.admin.tenant-credentials", moduleId: "access", kind: "section" as const, label: "i18n:govoplan-access.tenant_credentials.4af2c024", order: 70 },
|
|
{ id: "access.admin.tenant-api-keys", moduleId: "access", kind: "section" as const, label: "i18n:govoplan-access.tenant_api_keys.4b1d81f8", order: 80 },
|
|
{ id: "access.admin.tenant-service-accounts", moduleId: "access", kind: "section" as const, label: "Service accounts", order: 90 },
|
|
{ id: "access.admin.group-credentials", moduleId: "access", kind: "section" as const, label: "i18n:govoplan-access.group_credentials.4af2c025", order: 30 },
|
|
{ id: "access.admin.user-credentials", moduleId: "access", kind: "section" as const, label: "i18n:govoplan-access.user_credentials.4af2c026", order: 30 },
|
|
{ id: "access.settings.credentials", moduleId: "access", kind: "section" as const, label: "i18n:govoplan-access.reusable_credentials.4af2c022", order: 30 }
|
|
];
|
|
|
|
function renderAdminRoute({ settings, auth, onAuthChange }: PlatformRouteContext) {
|
|
if (!onAuthChange) {
|
|
throw new Error("i18n:govoplan-access.the_access_admin_route_requires_the_platform_aut.0173a45f");
|
|
}
|
|
return createElement(AdminPage, { settings, auth, onAuthChange });
|
|
}
|
|
|
|
export const accessModule: PlatformWebModule = {
|
|
id: "access",
|
|
label: "i18n:govoplan-access.access.2f81a22d",
|
|
version: "0.1.11",
|
|
translations,
|
|
viewSurfaces: accessAdminSurfaces,
|
|
navItems: [
|
|
{ to: "/admin", label: "i18n:govoplan-access.admin.4e7afebc", iconName: "admin", anyOf: adminReadScopes, order: 900 }],
|
|
|
|
routes: [
|
|
{ path: "/admin", anyOf: adminReadScopes, order: 900, render: renderAdminRoute }],
|
|
uiCapabilities: {
|
|
"access.actingContext": { Selector: ActingContextSelector } satisfies ActingContextRuntimeUiCapability
|
|
}
|
|
};
|
|
|
|
export default accessModule;
|