fix(editor): Make resource locator work with data tables (no-changelog) (#18899)

This commit is contained in:
Jaakko Husso
2025-08-28 11:38:47 +03:00
committed by GitHub
parent d244b99484
commit ab7998b441
7 changed files with 36 additions and 4 deletions

View File

@@ -10,6 +10,7 @@ import type { INodePropertyOptions, NodeParameterValueType } from 'n8n-workflow'
import { DynamicNodeParametersService } from '@/services/dynamic-node-parameters.service';
import { getBase } from '@/workflow-execute-additional-data';
import { userHasScopes } from '@/permissions.ee/check-access';
@RestController('/dynamic-node-parameters')
export class DynamicNodeParametersController {
@@ -70,10 +71,22 @@ export class DynamicNodeParametersController {
credentials,
currentNodeParameters,
nodeTypeAndVersion,
projectId,
} = payload;
const additionalData = await getBase(req.user.id, currentNodeParameters);
if (projectId) {
if (await userHasScopes(req.user, ['dataStore:listProject'], false, { projectId })) {
// Project ID is currently only added on the additionalData if the user
// has data store listing permission for that project. We should consider
// turning this into a more general check, but as of now data stores are
// the only nodes with project specific resource locators where we want to ensure
// that only data stores belonging to their respective projects are shown.
additionalData.dataStoreProjectId = projectId;
}
}
return await this.service.getResourceLocatorResults(
methodName,
path,

View File

@@ -47,9 +47,10 @@ export class DataStoreProxyService implements DataStoreProxyProvider {
async getDataStoreAggregateProxy(
workflow: Workflow,
node: INode,
dataStoreProjectId?: string,
): Promise<IDataStoreProjectAggregateService> {
this.validateRequest(node);
const projectId = await this.getProjectId(workflow);
const projectId = dataStoreProjectId ?? (await this.getProjectId(workflow));
return this.makeAggregateOperations(projectId);
}
@@ -58,9 +59,10 @@ export class DataStoreProxyService implements DataStoreProxyProvider {
workflow: Workflow,
node: INode,
dataStoreId: string,
dataStoreProjectId?: string,
): Promise<IDataStoreProjectService> {
this.validateRequest(node);
const projectId = await this.getProjectId(workflow);
const projectId = dataStoreProjectId ?? (await this.getProjectId(workflow));
return this.makeDataStoreOperations(projectId, dataStoreId);
}