From ed81de5065b67227481ea558c04b28983c925b91 Mon Sep 17 00:00:00 2001 From: Valya Bullions Date: Tue, 23 Jul 2024 15:22:52 +0100 Subject: [PATCH] review changes --- .../cli/src/credentials/credentials.controller.ts | 6 +++--- .../cli/src/credentials/credentials.service.ee.ts | 2 +- .../credentials/credentials.api.ee.test.ts | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/cli/src/credentials/credentials.controller.ts b/packages/cli/src/credentials/credentials.controller.ts index c282cfbc09c4f..9ee92c9bcf75d 100644 --- a/packages/cli/src/credentials/credentials.controller.ts +++ b/packages/cli/src/credentials/credentials.controller.ts @@ -308,15 +308,15 @@ export class CredentialsController { let newShareeIds: string[] = []; await Db.transaction(async (trx) => { - const currentProjectIDs = credential.shared + const currentProjectIds = credential.shared .filter((sc) => sc.role === 'credential:user') .map((sc) => sc.projectId); const newProjectIds = shareWithIds; - const toShare = utils.rightDiff([currentProjectIDs, (id) => id], [newProjectIds, (id) => id]); + const toShare = utils.rightDiff([currentProjectIds, (id) => id], [newProjectIds, (id) => id]); const toUnshare = utils.rightDiff( [newProjectIds, (id) => id], - [currentProjectIDs, (id) => id], + [currentProjectIds, (id) => id], ); const deleteResult = await trx.delete(SharedCredentials, { diff --git a/packages/cli/src/credentials/credentials.service.ee.ts b/packages/cli/src/credentials/credentials.service.ee.ts index 83d4012bc2475..885e5b87356f3 100644 --- a/packages/cli/src/credentials/credentials.service.ee.ts +++ b/packages/cli/src/credentials/credentials.service.ee.ts @@ -38,7 +38,7 @@ export class EnterpriseCredentialsService { id: In(shareWithIds), type: 'team', // if user can see all projects, don't check project access - // if they don't, find projects they can list + // if they can't, find projects they can list ...(user.hasGlobalScope('project:list') ? {} : { diff --git a/packages/cli/test/integration/credentials/credentials.api.ee.test.ts b/packages/cli/test/integration/credentials/credentials.api.ee.test.ts index 3d1fd204713a4..8737f10f7507a 100644 --- a/packages/cli/test/integration/credentials/credentials.api.ee.test.ts +++ b/packages/cli/test/integration/credentials/credentials.api.ee.test.ts @@ -981,7 +981,7 @@ describe('PUT /credentials/:id/share', () => { config.set('userManagement.emails.mode', 'smtp'); }); - test('should be able to share from personal project to team project that member has access to', async () => { + test('member should be able to share from personal project to team project that member has access to', async () => { const savedCredential = await saveCredential(randomCredentialPayload(), { user: member }); const testProject = await createTeamProject(); @@ -1000,7 +1000,7 @@ describe('PUT /credentials/:id/share', () => { expect(testShare?.role).toBe('credential:user'); }); - test('should be able to share from team project to personal project', async () => { + test('member should be able to share from team project to personal project', async () => { const testProject = await createTeamProject(undefined, member); const savedCredential = await saveCredential(randomCredentialPayload(), { @@ -1020,7 +1020,7 @@ describe('PUT /credentials/:id/share', () => { expect(testShare?.role).toBe('credential:user'); }); - test('should be able to share from team project to team project that member has access to', async () => { + test('member should be able to share from team project to team project that member has access to', async () => { const testProject = await createTeamProject(undefined, member); const testProject2 = await createTeamProject(); await linkUserToProject(member, testProject2, 'project:editor'); @@ -1042,7 +1042,7 @@ describe('PUT /credentials/:id/share', () => { expect(testShare?.role).toBe('credential:user'); }); - test('admins should be able to share from any team project to team project ', async () => { + test('admins should be able to share from any team project to any team project ', async () => { const testProject = await createTeamProject(); const testProject2 = await createTeamProject(); @@ -1063,7 +1063,7 @@ describe('PUT /credentials/:id/share', () => { expect(testShare?.role).toBe('credential:user'); }); - test('admins should be able to share from any team project to personal project ', async () => { + test("admins should be able to share from any team project to any user's personal project ", async () => { const testProject = await createTeamProject(); const savedCredential = await saveCredential(randomCredentialPayload(), { @@ -1083,7 +1083,7 @@ describe('PUT /credentials/:id/share', () => { expect(testShare?.role).toBe('credential:user'); }); - test('admins should be able to share from any personal project to team project ', async () => { + test('admins should be able to share from any personal project to any team project ', async () => { const testProject = await createTeamProject(); const savedCredential = await saveCredential(randomCredentialPayload(), {