refactor(core): Modernize credentials controllers and services (no-changelog) (#8488)
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
@@ -24,6 +24,7 @@ export class EnterpriseWorkflowService {
|
||||
private readonly sharedWorkflowRepository: SharedWorkflowRepository,
|
||||
private readonly workflowRepository: WorkflowRepository,
|
||||
private readonly credentialsRepository: CredentialsRepository,
|
||||
private readonly credentialsService: CredentialsService,
|
||||
) {}
|
||||
|
||||
async isOwned(
|
||||
@@ -70,7 +71,7 @@ export class EnterpriseWorkflowService {
|
||||
currentUser: User,
|
||||
): Promise<void> {
|
||||
workflow.usedCredentials = [];
|
||||
const userCredentials = await CredentialsService.getMany(currentUser, { onlyOwn: true });
|
||||
const userCredentials = await this.credentialsService.getMany(currentUser, { onlyOwn: true });
|
||||
const credentialIdsUsedByWorkflow = new Set<string>();
|
||||
workflow.nodes.forEach((node) => {
|
||||
if (!node.credentials) {
|
||||
@@ -139,7 +140,7 @@ export class EnterpriseWorkflowService {
|
||||
throw new NotFoundError('Workflow not found');
|
||||
}
|
||||
|
||||
const allCredentials = await CredentialsService.getMany(user);
|
||||
const allCredentials = await this.credentialsService.getMany(user);
|
||||
|
||||
try {
|
||||
return this.validateWorkflowCredentialUsage(workflow, previousVersion, allCredentials);
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { Service } from 'typedi';
|
||||
import express from 'express';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import axios from 'axios';
|
||||
@@ -40,7 +39,6 @@ import { WorkflowExecutionService } from './workflowExecution.service';
|
||||
import { WorkflowSharingService } from './workflowSharing.service';
|
||||
import { UserManagementMailer } from '@/UserManagement/email';
|
||||
|
||||
@Service()
|
||||
@Authorized()
|
||||
@RestController('/workflows')
|
||||
export class WorkflowsController {
|
||||
@@ -62,6 +60,7 @@ export class WorkflowsController {
|
||||
private readonly userRepository: UserRepository,
|
||||
private readonly license: License,
|
||||
private readonly mailer: UserManagementMailer,
|
||||
private readonly credentialsService: CredentialsService,
|
||||
) {}
|
||||
|
||||
@Post('/')
|
||||
@@ -92,7 +91,7 @@ export class WorkflowsController {
|
||||
// This is a new workflow, so we simply check if the user has access to
|
||||
// all used workflows
|
||||
|
||||
const allCredentials = await CredentialsService.getMany(req.user);
|
||||
const allCredentials = await this.credentialsService.getMany(req.user);
|
||||
|
||||
try {
|
||||
this.enterpriseWorkflowService.validateCredentialPermissionsToUser(
|
||||
|
||||
Reference in New Issue
Block a user