mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
refactor(core): Convert OAuth1/OAuth2 routes to decorated controller classes (no-changelog) (#5973)
This commit is contained in:
committed by
GitHub
parent
c6049a2e97
commit
acec9bad71
@@ -50,7 +50,6 @@ import type { CredentialsEntity } from '@db/entities/CredentialsEntity';
|
||||
import { NodeTypes } from '@/NodeTypes';
|
||||
import { CredentialTypes } from '@/CredentialTypes';
|
||||
import { CredentialsOverwrites } from '@/CredentialsOverwrites';
|
||||
import { whereClause } from './UserManagement/UserManagementHelper';
|
||||
import { RESPONSE_ERROR_MESSAGES } from './constants';
|
||||
import { isObjectLiteral } from './utils';
|
||||
import { Logger } from '@/Logger';
|
||||
@@ -213,7 +212,7 @@ export class CredentialsHelper extends ICredentialsHelper {
|
||||
/**
|
||||
* Resolves the given value in case it is an expression
|
||||
*/
|
||||
resolveValue(
|
||||
private resolveValue(
|
||||
parameterValue: string,
|
||||
additionalKeys: IWorkflowDataProxyAdditionalKeys,
|
||||
workflow: Workflow,
|
||||
@@ -248,9 +247,6 @@ export class CredentialsHelper extends ICredentialsHelper {
|
||||
|
||||
/**
|
||||
* Returns the credentials instance
|
||||
*
|
||||
* @param {INodeCredentialsDetails} nodeCredential id and name to return instance of
|
||||
* @param {string} type Type of the credential to return instance of
|
||||
*/
|
||||
async getCredentials(
|
||||
nodeCredential: INodeCredentialsDetails,
|
||||
@@ -284,8 +280,6 @@ export class CredentialsHelper extends ICredentialsHelper {
|
||||
|
||||
/**
|
||||
* Returns all the properties of the credentials with the given name
|
||||
*
|
||||
* @param {string} type The name of the type to return credentials off
|
||||
*/
|
||||
getCredentialsProperties(type: string): INodeProperties[] {
|
||||
const credentialTypeData = this.credentialTypes.getByName(type);
|
||||
@@ -327,10 +321,6 @@ export class CredentialsHelper extends ICredentialsHelper {
|
||||
|
||||
/**
|
||||
* Returns the decrypted credential data with applied overwrites
|
||||
*
|
||||
* @param {INodeCredentialsDetails} nodeCredentials id and name to return instance of
|
||||
* @param {string} type Type of the credentials to return data of
|
||||
* @param {boolean} [raw] Return the data as supplied without defaults or overwrites
|
||||
*/
|
||||
async getDecrypted(
|
||||
additionalData: IWorkflowExecuteAdditionalData,
|
||||
@@ -443,10 +433,6 @@ export class CredentialsHelper extends ICredentialsHelper {
|
||||
|
||||
/**
|
||||
* Updates credentials in the database
|
||||
*
|
||||
* @param {string} name Name of the credentials to set data of
|
||||
* @param {string} type Type of the credentials to set data of
|
||||
* @param {ICredentialDataDecryptedObject} data The data to set
|
||||
*/
|
||||
async updateCredentials(
|
||||
nodeCredentials: INodeCredentialsDetails,
|
||||
@@ -804,36 +790,6 @@ export class CredentialsHelper extends ICredentialsHelper {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a credential if it has been shared with a user.
|
||||
*/
|
||||
export async function getCredentialForUser(
|
||||
credentialId: string,
|
||||
user: User,
|
||||
): Promise<ICredentialsDb | null> {
|
||||
const sharedCredential = await Db.collections.SharedCredentials.findOne({
|
||||
relations: ['credentials'],
|
||||
where: whereClause({
|
||||
user,
|
||||
entityType: 'credentials',
|
||||
entityId: credentialId,
|
||||
}),
|
||||
});
|
||||
|
||||
if (!sharedCredential) return null;
|
||||
|
||||
return sharedCredential.credentials as ICredentialsDb;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a credential without user check
|
||||
*/
|
||||
export async function getCredentialWithoutUser(
|
||||
credentialId: string,
|
||||
): Promise<ICredentialsDb | null> {
|
||||
return Db.collections.Credentials.findOneBy({ id: credentialId });
|
||||
}
|
||||
|
||||
export function createCredentialsFromCredentialsEntity(
|
||||
credential: CredentialsEntity,
|
||||
encrypt = false,
|
||||
|
||||
Reference in New Issue
Block a user