fix: Apply credential overwrites recursively (#5072)
This ensures that overwrites defined for a parent credential type also applies to all credentials extending it.
This commit is contained in:
committed by
GitHub
parent
f1184ccab5
commit
5d746c4a83
@@ -8,6 +8,7 @@ import set from 'lodash.set';
|
||||
import { BinaryDataManager, UserSettings } from 'n8n-core';
|
||||
import {
|
||||
ICredentialType,
|
||||
ICredentialTypes,
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
INode,
|
||||
@@ -71,6 +72,7 @@ import { eventBusRouter } from '@/eventbus/eventBusRoutes';
|
||||
const loadNodesAndCredentials: INodesAndCredentials = {
|
||||
loaded: { nodes: {}, credentials: {} },
|
||||
known: { nodes: {}, credentials: {} },
|
||||
credentialTypes: {} as ICredentialTypes,
|
||||
};
|
||||
|
||||
const mockNodeTypes = NodeTypes(loadNodesAndCredentials);
|
||||
@@ -160,7 +162,7 @@ export async function initTestServer({
|
||||
* Pre-requisite: Mock the telemetry module before calling.
|
||||
*/
|
||||
export function initTestTelemetry() {
|
||||
void InternalHooksManager.init('test-instance-id', 'test-version', mockNodeTypes);
|
||||
void InternalHooksManager.init('test-instance-id', mockNodeTypes);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -43,4 +43,5 @@ const mockNodesAndCredentials = (): INodesAndCredentials => ({
|
||||
},
|
||||
},
|
||||
known: { nodes: {}, credentials: {} },
|
||||
credentialTypes: {} as ICredentialTypes,
|
||||
});
|
||||
|
||||
@@ -2,6 +2,7 @@ import {
|
||||
IAuthenticateGeneric,
|
||||
ICredentialDataDecryptedObject,
|
||||
ICredentialType,
|
||||
ICredentialTypes,
|
||||
IHttpRequestOptions,
|
||||
INode,
|
||||
INodeProperties,
|
||||
@@ -16,6 +17,7 @@ const TEST_ENCRYPTION_KEY = 'test';
|
||||
const mockNodesAndCredentials: INodesAndCredentials = {
|
||||
loaded: { nodes: {}, credentials: {} },
|
||||
known: { nodes: {}, credentials: {} },
|
||||
credentialTypes: {} as ICredentialTypes,
|
||||
};
|
||||
|
||||
describe('CredentialsHelper', () => {
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import { INodeTypeData, INodeTypes, SubworkflowOperationError, Workflow } from 'n8n-workflow';
|
||||
import {
|
||||
ICredentialTypes,
|
||||
INodeTypeData,
|
||||
INodeTypes,
|
||||
SubworkflowOperationError,
|
||||
Workflow,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import config from '@/config';
|
||||
import * as Db from '@/Db';
|
||||
@@ -35,6 +41,7 @@ beforeAll(async () => {
|
||||
credentials: {},
|
||||
},
|
||||
known: { nodes: {}, credentials: {} },
|
||||
credentialTypes: {} as ICredentialTypes,
|
||||
});
|
||||
|
||||
credentialOwnerRole = await testDb.getCredentialOwnerRole();
|
||||
|
||||
Reference in New Issue
Block a user