Refine launcher admin access workflows
This commit is contained in:
@@ -41,6 +41,7 @@ const engineWorkflowAccessRequestStatuses = new Set(["new", "approved", "rejecte
|
||||
const engineWorkflowAccessRequestTypes = new Set(["workflow", "service_role"]);
|
||||
const engineWorkflowRoles = new Set(["viewer", "editor", "admin"]);
|
||||
const engineServiceRoles = new Set(["viewer", "member"]);
|
||||
const syncStates = new Set(["synced", "pending", "error", "disabled"]);
|
||||
const publicPoolClientId = "client_public_pool";
|
||||
const protectedLauncherUserIds = new Set(["user_root"]);
|
||||
const engineAuthentikGroups = ["nodedc_admin", "nodedc_editor", "nodedc_viewer"];
|
||||
@@ -2043,6 +2044,42 @@ export function createControlPlaneStore({ projectRoot }) {
|
||||
return { syncStatus, data };
|
||||
}
|
||||
|
||||
async function updateSyncStatus(syncId, patch, identity) {
|
||||
const data = readData();
|
||||
const actor = resolveActor(data, identity);
|
||||
const syncStatus = findById(data.syncStatuses, syncId, "sync status");
|
||||
const now = isoNow();
|
||||
|
||||
if ("state" in (patch ?? {})) {
|
||||
syncStatus.state = pickEnum(patch.state, syncStates, syncStatus.state);
|
||||
}
|
||||
|
||||
if ("error" in (patch ?? {})) {
|
||||
syncStatus.error = nullableString(patch.error);
|
||||
}
|
||||
|
||||
if ("objectName" in (patch ?? {})) {
|
||||
syncStatus.objectName = optionalString(patch.objectName, syncStatus.objectName);
|
||||
}
|
||||
|
||||
if (syncStatus.state === "synced") {
|
||||
syncStatus.lastSyncAt = nullableString(patch?.lastSyncAt) ?? now;
|
||||
syncStatus.error = null;
|
||||
}
|
||||
|
||||
syncStatus.updatedAt = now;
|
||||
addAuditEvent(data, actor, {
|
||||
action: "Статус sync обновлён",
|
||||
objectType: syncStatus.objectType,
|
||||
objectName: syncStatus.objectName,
|
||||
result: syncStatus.state === "error" ? "error" : "success",
|
||||
details: `Target: ${syncStatus.target}; State: ${syncStatus.state}`,
|
||||
});
|
||||
|
||||
await writeData(data);
|
||||
return { syncStatus, data };
|
||||
}
|
||||
|
||||
async function markUserAuthentikProvisioned(userId, provisioning, identity) {
|
||||
const data = readData();
|
||||
const actor = resolveActor(data, identity);
|
||||
@@ -2191,6 +2228,7 @@ export function createControlPlaneStore({ projectRoot }) {
|
||||
replaceData,
|
||||
reorderServices,
|
||||
retrySync,
|
||||
updateSyncStatus,
|
||||
markUserAuthentikProvisioned,
|
||||
recordTaskManagerProjectMembership,
|
||||
recordTaskManagerWorkspaceMembership,
|
||||
|
||||
Reference in New Issue
Block a user