Skip to content

Commit

Permalink
fix(core): Add sharing data to workflows in EE executions (#6872)
Browse files Browse the repository at this point in the history
* fix(core): Add sharing data to workflows in EE executions

* Address feedback
  • Loading branch information
ivov authored Aug 8, 2023
1 parent 11440bf commit 6796d9e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/cli/src/executions/executions.service.ee.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import type { User } from '@db/entities/User';
import { getSharedWorkflowIds } from '@/WorkflowHelpers';
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 {
/**
Expand All @@ -10,4 +15,21 @@ export class EEExecutionsService extends ExecutionsService {
// Get all workflows
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;
}
}

0 comments on commit 6796d9e

Please sign in to comment.