twenty / packages /twenty-server /src /engine /twenty-orm /utils /build-system-auth-context.util.ts
Jules
Initial clean CRM deployment with prebuilt assets
d9494a5
Raw
History Blame Contribute Delete
705 Bytes
import { type SystemWorkspaceAuthContext } from 'src/engine/core-modules/auth/types/workspace-auth-context.type';
import { buildSystemAuthContext as buildSystemAuthContextUtil } from 'src/engine/core-modules/auth/utils/build-system-auth-context.util';
import { type FlatWorkspace } from 'src/engine/core-modules/workspace/types/flat-workspace.type';
// Builds a minimal WorkspaceAuthContext for system operations (jobs, commands, crons)
// that don't have a user context but need to operate on a workspace
export const buildSystemAuthContext = (
workspaceId: string,
): SystemWorkspaceAuthContext => {
return buildSystemAuthContextUtil({
workspace: { id: workspaceId } as FlatWorkspace,
});
};