refactor(core, editor): Remove legacy nodesAccess (no-changelog) (#9016)
This commit is contained in:
@@ -25,7 +25,6 @@ import { SourceControlPreferencesService } from './sourceControlPreferences.serv
|
||||
import { writeFileSync } from 'fs';
|
||||
import { SourceControlImportService } from './sourceControlImport.service.ee';
|
||||
import type { User } from '@db/entities/User';
|
||||
import isEqual from 'lodash/isEqual';
|
||||
import type { SourceControlGetStatus } from './types/sourceControlGetStatus';
|
||||
import type { TagEntity } from '@db/entities/TagEntity';
|
||||
import type { Variables } from '@db/entities/Variables';
|
||||
@@ -384,7 +383,7 @@ export class SourceControlService {
|
||||
* Does a comparison between the local and remote workfolder based on NOT the git status,
|
||||
* but certain parameters within the items being synced.
|
||||
* For workflows, it compares the versionIds
|
||||
* For credentials, it compares the name, type and nodeAccess
|
||||
* For credentials, it compares the name and type
|
||||
* For variables, it compares the name
|
||||
* For tags, it compares the name and mapping
|
||||
* @returns either SourceControlledFile[] if verbose is false,
|
||||
@@ -565,12 +564,7 @@ export class SourceControlService {
|
||||
> = [];
|
||||
credLocalIds.forEach((local) => {
|
||||
const mismatchingCreds = credRemoteIds.find((remote) => {
|
||||
return (
|
||||
remote.id === local.id &&
|
||||
(remote.name !== local.name ||
|
||||
remote.type !== local.type ||
|
||||
!isEqual(remote.nodesAccess, local.nodesAccess))
|
||||
);
|
||||
return remote.id === local.id && (remote.name !== local.name || remote.type !== local.type);
|
||||
});
|
||||
if (mismatchingCreds) {
|
||||
credModifiedInEither.push({
|
||||
|
||||
@@ -240,15 +240,14 @@ export class SourceControlExportService {
|
||||
}
|
||||
await Promise.all(
|
||||
credentialsToBeExported.map(async (sharing) => {
|
||||
const { name, type, nodesAccess, data, id } = sharing.credentials;
|
||||
const credentials = new Credentials({ id, name }, type, nodesAccess, data);
|
||||
const { name, type, data, id } = sharing.credentials;
|
||||
const credentials = new Credentials({ id, name }, type, data);
|
||||
|
||||
const stub: ExportableCredential = {
|
||||
id,
|
||||
name,
|
||||
type,
|
||||
data: this.replaceCredentialData(credentials.getData()),
|
||||
nodesAccess,
|
||||
ownedBy: sharing.user.email,
|
||||
};
|
||||
|
||||
|
||||
@@ -142,13 +142,12 @@ export class SourceControlImportService {
|
||||
Array<ExportableCredential & { filename: string }>
|
||||
> {
|
||||
const localCredentials = await Container.get(CredentialsRepository).find({
|
||||
select: ['id', 'name', 'type', 'nodesAccess'],
|
||||
select: ['id', 'name', 'type'],
|
||||
});
|
||||
return localCredentials.map((local) => ({
|
||||
id: local.id,
|
||||
name: local.name,
|
||||
type: local.type,
|
||||
nodesAccess: local.nodesAccess,
|
||||
filename: getCredentialExportPath(local.id, this.credentialExportFolder),
|
||||
})) as Array<ExportableCredential & { filename: string }>;
|
||||
}
|
||||
@@ -339,14 +338,13 @@ export class SourceControlImportService {
|
||||
(e) => e.id === credential.id && e.type === credential.type,
|
||||
);
|
||||
|
||||
const { name, type, data, id, nodesAccess } = credential;
|
||||
const newCredentialObject = new Credentials({ id, name }, type, []);
|
||||
const { name, type, data, id } = credential;
|
||||
const newCredentialObject = new Credentials({ id, name }, type);
|
||||
if (existingCredential?.data) {
|
||||
newCredentialObject.data = existingCredential.data;
|
||||
} else {
|
||||
newCredentialObject.setData(data);
|
||||
}
|
||||
newCredentialObject.nodesAccess = nodesAccess || existingCredential?.nodesAccess || [];
|
||||
|
||||
this.logger.debug(`Updating credential id ${newCredentialObject.id as string}`);
|
||||
await Container.get(CredentialsRepository).upsert(newCredentialObject, ['id']);
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import type { ICredentialDataDecryptedObject, ICredentialNodeAccess } from 'n8n-workflow';
|
||||
import type { ICredentialDataDecryptedObject } from 'n8n-workflow';
|
||||
|
||||
export interface ExportableCredential {
|
||||
id: string;
|
||||
name: string;
|
||||
type: string;
|
||||
data: ICredentialDataDecryptedObject;
|
||||
nodesAccess: ICredentialNodeAccess[];
|
||||
|
||||
/**
|
||||
* Email of the user who owns this credential at the source instance.
|
||||
|
||||
Reference in New Issue
Block a user