mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
fix(editor): Make resource locator work with data tables (no-changelog) (#18899)
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user