FEAT - LAUNCHER: wire Engine access roles
This commit is contained in:
@@ -37,6 +37,14 @@ const accessRequestStatuses = new Set(["new", "approved", "rejected"]);
|
||||
const taskerInviteRequestStatuses = new Set(["new", "approved", "rejected", "cancelled"]);
|
||||
const taskManagerInviteRoles = new Set(["guest", "member", "admin"]);
|
||||
const publicPoolClientId = "client_public_pool";
|
||||
const engineAuthentikGroups = [
|
||||
"nodedc:engine:admin",
|
||||
"nodedc:engine:editor",
|
||||
"nodedc:engine:viewer",
|
||||
"nodedc_admin",
|
||||
"nodedc_editor",
|
||||
"nodedc_viewer",
|
||||
];
|
||||
const publicPoolClient = {
|
||||
id: publicPoolClientId,
|
||||
type: "person",
|
||||
@@ -1811,6 +1819,7 @@ export function createControlPlaneStore({ projectRoot }) {
|
||||
"nodedc:superadmin",
|
||||
"nodedc:launcher:admin",
|
||||
"nodedc:launcher:user",
|
||||
...engineAuthentikGroups,
|
||||
...data.services.flatMap((service) => (service.authentikGroupName ? [service.authentikGroupName] : [])),
|
||||
...data.groups.map((group) => `client:${group.clientId}:group:${slugify(group.name)}`),
|
||||
],
|
||||
@@ -1931,6 +1940,7 @@ function normalizeData(payload) {
|
||||
...client,
|
||||
integrations: normalizeClientIntegrations(client.integrations),
|
||||
}));
|
||||
data.services = data.services.map(normalizeService);
|
||||
data.accessRequests = data.accessRequests.map(normalizeAccessRequest).filter(Boolean);
|
||||
data.revokedAccounts = data.revokedAccounts.map(normalizeRevokedAccount).filter(Boolean);
|
||||
data.serviceModuleEntitlements = data.serviceModuleEntitlements.map(normalizeServiceModuleEntitlement).filter(Boolean);
|
||||
@@ -1938,6 +1948,23 @@ function normalizeData(payload) {
|
||||
return data;
|
||||
}
|
||||
|
||||
function normalizeService(service) {
|
||||
if (typeof service !== "object" || service === null) return service;
|
||||
if (service.id !== "service_nodedc" && service.slug !== "nodedc" && service.authentikApplicationSlug !== "nodedc") return service;
|
||||
|
||||
return {
|
||||
...service,
|
||||
title: service.title === "AGENT CORE" || service.title === "NodeDC" ? "ENGINE" : service.title,
|
||||
url: service.url === "https://nodedc.ru/" || service.url === "https://dev.handhdc.ru/sso/launch" ? "https://engine.nodedc.ru/" : service.url,
|
||||
launchUrl:
|
||||
service.launchUrl === "https://nodedc.ru/" || service.launchUrl === "https://dev.handhdc.ru/sso/launch"
|
||||
? "https://engine.nodedc.ru/"
|
||||
: service.launchUrl,
|
||||
authentikApplicationSlug: service.authentikApplicationSlug === "nodedc" ? "nodedc-engine" : service.authentikApplicationSlug,
|
||||
authentikGroupName: service.authentikGroupName === "service-nodedc" ? "nodedc:engine:viewer" : service.authentikGroupName,
|
||||
};
|
||||
}
|
||||
|
||||
function normalizeServiceModuleEntitlement(payload) {
|
||||
if (typeof payload !== "object" || payload === null) return null;
|
||||
const clientId = nullableString(payload.clientId);
|
||||
|
||||
Reference in New Issue
Block a user