refactor(core): Move all user DB access to UserRepository (#6910)

Prep for https://linear.app/n8n/issue/PAY-646
This commit is contained in:
Iván Ovejero
2023-08-22 15:58:05 +02:00
committed by GitHub
parent 67b88f75f4
commit 96a9de68a0
20 changed files with 209 additions and 184 deletions

View File

@@ -11,7 +11,7 @@ import config from '@/config';
import type { SharedCredentials } from '@db/entities/SharedCredentials';
import { isSharingEnabled } from './UserManagementHelper';
import { WorkflowsService } from '@/workflows/workflows.services';
import { UserService } from '@/user/user.service';
import { UserService } from '@/services/user.service';
import { OwnershipService } from '@/services/ownership.service';
import Container from 'typedi';
import { RoleService } from '@/services/role.service';
@@ -135,7 +135,7 @@ export class PermissionChecker {
}
if (policy === 'workflowsFromSameOwner') {
const user = await UserService.get({ id: userId });
const user = await Container.get(UserService).findOne({ where: { id: userId } });
if (!user) {
throw new WorkflowOperationError(
'Fatal error: user not found. Please contact the system administrator.',