Revert "chore(core): Use roles from database in global roles (#17853)" (#18738)

This commit is contained in:
Andreas Fitzek
2025-08-25 14:29:28 +02:00
committed by GitHub
parent b62c957c71
commit a21a03d4b0
117 changed files with 410 additions and 875 deletions

View File

@@ -6,12 +6,7 @@ import {
randomValidPassword,
} from '@n8n/backend-test-utils';
import type { User } from '@n8n/db';
import {
GLOBAL_ADMIN_ROLE,
GLOBAL_MEMBER_ROLE,
ProjectRelationRepository,
UserRepository,
} from '@n8n/db';
import { ProjectRelationRepository, UserRepository } from '@n8n/db';
import { Container } from '@n8n/di';
import { Not } from '@n8n/typeorm';
@@ -57,7 +52,7 @@ describe('InvitationController', () => {
describe('POST /invitations/:id/accept', () => {
test('should fill out a member shell', async () => {
const memberShell = await createUserShell(GLOBAL_MEMBER_ROLE);
const memberShell = await createUserShell('global:member');
const memberProps = {
inviterId: instanceOwner.id,
@@ -88,7 +83,7 @@ describe('InvitationController', () => {
});
test('should fill out an admin shell', async () => {
const adminShell = await createUserShell(GLOBAL_ADMIN_ROLE);
const adminShell = await createUserShell('global:admin');
const memberProps = {
inviterId: instanceOwner.id,
@@ -121,7 +116,7 @@ describe('InvitationController', () => {
test('should fail with invalid payloads', async () => {
const memberShell = await userRepository.save({
email: randomEmail(),
role: { slug: 'global:member' },
role: 'global:member',
});
const invalidPaylods = [
@@ -379,7 +374,7 @@ describe('InvitationController', () => {
mailer.invite.mockResolvedValue({ emailSent: true });
const member = await createMember();
const memberShell = await createUserShell(GLOBAL_MEMBER_ROLE);
const memberShell = await createUserShell('global:member');
const newUserEmail = randomEmail();
const existingUserEmails = [member.email];