mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
fix(core): Add sharing data to workflows in EE executions (#6872)
* fix(core): Add sharing data to workflows in EE executions * Address feedback
This commit is contained in:
parent
11440bfd3c
commit
6796d9e5d6
|
@ -1,6 +1,11 @@
|
||||||
import type { User } from '@db/entities/User';
|
import type { User } from '@db/entities/User';
|
||||||
import { getSharedWorkflowIds } from '@/WorkflowHelpers';
|
import { getSharedWorkflowIds } from '@/WorkflowHelpers';
|
||||||
import { ExecutionsService } from './executions.service';
|
import { ExecutionsService } from './executions.service';
|
||||||
|
import type { ExecutionRequest } from '@/requests';
|
||||||
|
import type { IExecutionResponse, IExecutionFlattedResponse } from '@/Interfaces';
|
||||||
|
import { EEWorkflowsService as EEWorkflows } from '../workflows/workflows.services.ee';
|
||||||
|
import { WorkflowRepository } from '@/databases/repositories';
|
||||||
|
import Container from 'typedi';
|
||||||
|
|
||||||
export class EEExecutionsService extends ExecutionsService {
|
export class EEExecutionsService extends ExecutionsService {
|
||||||
/**
|
/**
|
||||||
|
@ -10,4 +15,21 @@ export class EEExecutionsService extends ExecutionsService {
|
||||||
// Get all workflows
|
// Get all workflows
|
||||||
return getSharedWorkflowIds(user);
|
return getSharedWorkflowIds(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static async getExecution(
|
||||||
|
req: ExecutionRequest.Get,
|
||||||
|
): Promise<IExecutionResponse | IExecutionFlattedResponse | undefined> {
|
||||||
|
const execution = await super.getExecution(req);
|
||||||
|
|
||||||
|
if (!execution) return;
|
||||||
|
|
||||||
|
const workflow = Container.get(WorkflowRepository).create(execution.workflowData);
|
||||||
|
|
||||||
|
EEWorkflows.addOwnerAndSharings(workflow);
|
||||||
|
await EEWorkflows.addCredentialsToWorkflow(workflow, req.user);
|
||||||
|
|
||||||
|
execution.workflowData = workflow;
|
||||||
|
|
||||||
|
return execution;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue