remove subworkflow license check

This commit is contained in:
Danny Martini 2024-09-19 23:15:11 +02:00
parent 48294e7ec1
commit 49c6942e6b
No known key found for this signature in database
2 changed files with 1 additions and 21 deletions

View file

@ -107,24 +107,6 @@ describe('SubworkflowPolicyChecker', () => {
});
describe('`any` caller policy', () => {
it('if no sharing, should be overriden to `workflows-from-same-owner`', async () => {
license.isSharingEnabled.mockReturnValueOnce(false);
const parentWorkflow = mock<WorkflowEntity>();
const subworkflowId = 'subworkflow-id';
const subworkflow = mock<Workflow>({ id: subworkflowId, settings: { callerPolicy: 'any' } }); // should be overridden
const parentWorkflowProject = mock<Project>({ id: uuid() });
const subworkflowProject = mock<Project>({ id: uuid(), type: 'team' });
ownershipService.getWorkflowProjectCached.mockResolvedValueOnce(parentWorkflowProject);
ownershipService.getWorkflowProjectCached.mockResolvedValueOnce(subworkflowProject);
const check = checker.check(subworkflow, parentWorkflow.id);
await expect(check).rejects.toThrowError(SubworkflowPolicyDenialError);
});
it('should not throw on a regular subworkflow call', async () => {
const parentWorkflow = mock<WorkflowEntity>({ id: uuid() });
const subworkflow = mock<Workflow>({ settings: { callerPolicy: 'any' } });

View file

@ -82,10 +82,8 @@ export class SubworkflowPolicyChecker {
* Find the subworkflow's caller policy.
*/
private findPolicy(subworkflow: Workflow): WorkflowSettings.CallerPolicy {
if (!this.license.isSharingEnabled()) return 'workflowsFromSameOwner';
return (
subworkflow.settings?.callerPolicy ?? this.globalConfig.workflows.callerPolicyDefaultOption
subworkflow.settings.callerPolicy ?? this.globalConfig.workflows.callerPolicyDefaultOption
);
}