feat(core): Implement project:viewer role (#9611)

This commit is contained in:
Danny Martini
2024-06-06 11:55:48 +02:00
committed by GitHub
parent e9e3b254fe
commit 6187cc5762
10 changed files with 933 additions and 745 deletions

View File

@@ -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]);