mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-20 19:32:15 +00:00
chore(core): Use roles from database in global roles (#18768)
This commit is contained in:
@@ -222,7 +222,7 @@ describe('Public API endpoints with feat:apiKeyScopes enabled', () => {
|
||||
expect(returnedUser.id).toBe(storedUser.id);
|
||||
expect(returnedUser.email).toBe(storedUser.email);
|
||||
expect(returnedUser.email).toBe(payloadUser.email);
|
||||
expect(storedUser.role).toBe(payloadUser.role);
|
||||
expect(storedUser.role.slug).toBe(payloadUser.role);
|
||||
});
|
||||
|
||||
test('should fail to create user when API key doesn\'t have "user:create" scope', async () => {
|
||||
@@ -267,7 +267,7 @@ describe('Public API endpoints with feat:apiKeyScopes enabled', () => {
|
||||
*/
|
||||
expect(response.status).toBe(204);
|
||||
const storedUser = await getUserById(member.id);
|
||||
expect(storedUser.role).toBe(payload.newRoleName);
|
||||
expect(storedUser.role.slug).toBe(payload.newRoleName);
|
||||
});
|
||||
|
||||
test('should fail to change role when API key doesn\'t have "user:changeRole" scope', async () => {
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
testDb,
|
||||
mockInstance,
|
||||
} from '@n8n/backend-test-utils';
|
||||
import type { User } from '@n8n/db';
|
||||
import { GLOBAL_MEMBER_ROLE, type User } from '@n8n/db';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import validator from 'validator';
|
||||
|
||||
@@ -155,7 +155,7 @@ describe('With license unlimited quota:users', () => {
|
||||
test('should return a pending user', async () => {
|
||||
const owner = await createOwnerWithApiKey();
|
||||
|
||||
const { id: memberId } = await createUserShell('global:member');
|
||||
const { id: memberId } = await createUserShell(GLOBAL_MEMBER_ROLE);
|
||||
|
||||
const authOwnerAgent = testServer.publicApiAgentFor(owner);
|
||||
const response = await authOwnerAgent.get(`/users/${memberId}`).expect(200);
|
||||
|
||||
@@ -95,7 +95,7 @@ describe('Users in Public API', () => {
|
||||
expect(returnedUser.id).toBe(storedUser.id);
|
||||
expect(returnedUser.email).toBe(storedUser.email);
|
||||
expect(returnedUser.email).toBe(payloadUser.email);
|
||||
expect(storedUser.role).toBe(payloadUser.role);
|
||||
expect(storedUser.role.slug).toBe(payloadUser.role);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -275,7 +275,7 @@ describe('Users in Public API', () => {
|
||||
*/
|
||||
expect(response.status).toBe(204);
|
||||
const storedUser = await getUserById(member.id);
|
||||
expect(storedUser.role).toBe(payload.newRoleName);
|
||||
expect(storedUser.role.slug).toBe(payload.newRoleName);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user