feat: Allow sharing to and from team projects (no-changelog) (#10144)

This commit is contained in:
Val
2024-08-09 11:59:28 +01:00
committed by GitHub
parent c9d9245451
commit 697bc90b0b
7 changed files with 219 additions and 21 deletions

View File

@@ -142,7 +142,13 @@ describe('GET /credentials', () => {
// Team cred
expect(cred1.id).toBe(savedCredential1.id);
expect(cred1.scopes).toEqual(
['credential:move', 'credential:read', 'credential:update', 'credential:delete'].sort(),
[
'credential:move',
'credential:read',
'credential:update',
'credential:share',
'credential:delete',
].sort(),
);
// Shared cred
@@ -389,6 +395,21 @@ describe('GET /credentials', () => {
expect(response2.body.data).toHaveLength(0);
});
test('should return homeProject when filtering credentials by projectId', async () => {
const project = await createTeamProject(undefined, member);
const credential = await saveCredential(payload(), { user: owner, role: 'credential:owner' });
await shareCredentialWithProjects(credential, [project]);
const response: GetAllResponse = await testServer
.authAgentFor(member)
.get('/credentials')
.query(`filter={ "projectId": "${project.id}" }`)
.expect(200);
expect(response.body.data).toHaveLength(1);
expect(response.body.data[0].homeProject).not.toBeNull();
});
test('should return all credentials in a team project that member is part of', async () => {
const teamProjectWithMember = await createTeamProject('Team Project With member', owner);
void (await linkUserToProject(member, teamProjectWithMember, 'project:editor'));