diff --git a/packages/cli/src/credentials/credentials.controller.ts b/packages/cli/src/credentials/credentials.controller.ts index 4ee65a831c6b5..ab12377258f79 100644 --- a/packages/cli/src/credentials/credentials.controller.ts +++ b/packages/cli/src/credentials/credentials.controller.ts @@ -291,15 +291,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(), {