mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat(core): Implement project:viewer role (#9611)
This commit is contained in:
@@ -7,6 +7,7 @@ import * as testDb from './shared/testDb';
|
||||
import { setupTestServer } from './shared/utils';
|
||||
import { mockInstance } from '../shared/mocking';
|
||||
import { WaitTracker } from '@/WaitTracker';
|
||||
import { createTeamProject, linkUserToProject } from './shared/db/projects';
|
||||
|
||||
const testServer = setupTestServer({ endpointGroups: ['executions'] });
|
||||
|
||||
@@ -45,6 +46,23 @@ describe('GET /executions', () => {
|
||||
});
|
||||
|
||||
describe('GET /executions/:id', () => {
|
||||
test('project viewers can view executions for workflows in the project', async () => {
|
||||
// if sharing is not enabled, we're only returning the executions of
|
||||
// personal workflows
|
||||
testServer.license.enable('feat:sharing');
|
||||
|
||||
const teamProject = await createTeamProject();
|
||||
await linkUserToProject(member, teamProject, 'project:viewer');
|
||||
|
||||
const workflow = await createWorkflow({}, teamProject);
|
||||
const execution = await createSuccessfulExecution(workflow);
|
||||
|
||||
const response = await testServer.authAgentFor(member).get(`/executions/${execution.id}`);
|
||||
|
||||
expect(response.statusCode).toBe(200);
|
||||
expect(response.body.data).toBeDefined();
|
||||
});
|
||||
|
||||
test('only returns executions of shared workflows if sharing is enabled', async () => {
|
||||
const workflow = await createWorkflow({}, owner);
|
||||
await shareWorkflowWithUsers(workflow, [member]);
|
||||
|
||||
Reference in New Issue
Block a user