Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
// SPDX-License-Identifier: AGPL-3.0-only
// Carbon (github.com/crbnos/carbon). Modified or adapted versions of this file,
// including ports, remain AGPLv3; serving them over a network requires releasing their source.
import { getCarbonServiceRole } from "@carbon/auth/client.server";
import { updatePermissions } from "@carbon/ee/permissions.server";
import { inngest } from "../../client";
// `updatePermissions` (the flattened-permission-object builder) is the licensed
// authoring logic and lives once in `@carbon/ee/permissions.server`. This task
// is just the durable wrapper for the bulk-edit path; it used to carry its own
// drifting copy.
export const updatePermissionsFunction = inngest.createFunction(
{ id: "update-permissions", retries: 3 },
{ event: "carbon/update-permissions" },
async ({ event, step, logger }) => {
const serviceRole = getCarbonServiceRole();
const payload = event.data;
const result = await step.run("update-permissions", async () => {
logger.info(`Permission Update for ${payload.id}`);
const { success, message } = await updatePermissions(
serviceRole,
payload
);
if (success) {
logger.info(`Permission Update for ${payload.id} succeeded`);
} else {
logger.error("Permission Update for {payloadId} failed", {
payloadId: payload.id,
message
});
}
return { success, message };
});
return result;
}
);