diff --git a/packages/cli/src/errors/subworkflow-policy-denial.error.ts b/packages/cli/src/errors/subworkflow-policy-denial.error.ts index b5fc2a139f1d5..c2440d9e7daa7 100644 --- a/packages/cli/src/errors/subworkflow-policy-denial.error.ts +++ b/packages/cli/src/errors/subworkflow-policy-denial.error.ts @@ -10,7 +10,7 @@ type Options = { subworkflowProject: Project; /** Whether the user has access to the subworkflow via project and scope. */ - hasAccess: boolean; + hasReadAccess: boolean; /** URL of the n8n instance. */ instanceUrl: string; @@ -30,7 +30,7 @@ export class SubworkflowPolicyDenialError extends WorkflowOperationError { subworkflowId, subworkflowProject, instanceUrl, - hasAccess, + hasReadAccess, ownerName, node, }: Options) { @@ -51,7 +51,7 @@ export class SubworkflowPolicyDenialError extends WorkflowOperationError { }; const description = () => { - if (hasAccess) return descriptions.accessible; + if (hasReadAccess) return descriptions.accessible; if (subworkflowProject.type === 'personal') return descriptions.inaccessiblePersonalProject; if (subworkflowProject.type === 'team') return descriptions.inaccesibleTeamProject; diff --git a/packages/cli/src/subworkflows/subworkflow-policy-checker.service.ts b/packages/cli/src/subworkflows/subworkflow-policy-checker.service.ts index c7a16f5be2046..33e6e58f76f91 100644 --- a/packages/cli/src/subworkflows/subworkflow-policy-checker.service.ts +++ b/packages/cli/src/subworkflows/subworkflow-policy-checker.service.ts @@ -61,18 +61,18 @@ export class SubworkflowPolicyChecker { } private async errorDetails(subworkflowProject: Project, subworkflow: Workflow, userId?: string) { - const hasAccess = userId + const hasReadAccess = userId ? await this.accessService.hasReadAccess(userId, subworkflow.id) : false; /* no user ID in policy check for error workflow, so `false` to keep error message generic */ - if (subworkflowProject.type === 'team') return { hasAccess }; + if (subworkflowProject.type === 'team') return { hasReadAccess }; const owner = await this.ownershipService.getPersonalProjectOwnerCached(subworkflowProject.id); assert(owner !== null); // only `null` if not personal return { - hasAccess, + hasReadAccess, ownerName: owner.firstName + ' ' + owner.lastName, }; }