Skip to content

Commit e3a5f22

Browse files
authored
CCM-10432 multi user cleanup (#676)
1 parent c95e9c4 commit e3a5f22

17 files changed

+133
-1110
lines changed

infrastructure/terraform/modules/backend-api/module_delete_template_lambda.tf

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,6 @@ data "aws_iam_policy_document" "delete_template_lambda_policy" {
4848
]
4949
}
5050

51-
statement {
52-
sid = "AllowDynamoGSIAccess"
53-
effect = "Allow"
54-
55-
actions = [
56-
"dynamodb:Query",
57-
]
58-
59-
resources = [
60-
"${aws_dynamodb_table.templates.arn}/index/QueryById",
61-
]
62-
}
63-
6451
statement {
6552
sid = "AllowKMSAccess"
6653
effect = "Allow"

infrastructure/terraform/modules/backend-api/module_get_template_lambda.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ data "aws_iam_policy_document" "get_template_lambda_policy" {
4040
effect = "Allow"
4141

4242
actions = [
43-
"dynamodb:BatchGetItem",
43+
"dynamodb:GetItem",
4444
]
4545

4646
resources = [

infrastructure/terraform/modules/backend-api/module_lambda_validate_letter_template_files.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ data "aws_iam_policy_document" "validate_letter_template_files" {
5555
effect = "Allow"
5656

5757
actions = [
58-
"dynamodb:BatchGetItem",
58+
"dynamodb:GetItem",
5959
"dynamodb:UpdateItem",
6060
]
6161

infrastructure/terraform/modules/backend-api/module_submit_template_lambda.tf

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,6 @@ data "aws_iam_policy_document" "submit_template_lambda_policy" {
4848
]
4949
}
5050

51-
statement {
52-
sid = "AllowDynamoGSIAccess"
53-
effect = "Allow"
54-
55-
actions = [
56-
"dynamodb:Query",
57-
]
58-
59-
resources = [
60-
"${aws_dynamodb_table.templates.arn}/index/QueryById",
61-
]
62-
}
63-
6451
statement {
6552
sid = "AllowKMSAccess"
6653
effect = "Allow"

infrastructure/terraform/modules/backend-api/module_update_template_lambda.tf

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,6 @@ data "aws_iam_policy_document" "update_template_lambda_policy" {
4848
]
4949
}
5050

51-
statement {
52-
sid = "AllowDynamoGSIAccess"
53-
effect = "Allow"
54-
55-
actions = [
56-
"dynamodb:Query",
57-
]
58-
59-
resources = [
60-
"${aws_dynamodb_table.templates.arn}/index/QueryById",
61-
]
62-
}
63-
6451
statement {
6552
sid = "AllowKMSAccess"
6653
effect = "Allow"

infrastructure/terraform/modules/backend-api/module_upload_letter_template_lambda.tf

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,6 @@ data "aws_iam_policy_document" "upload_letter_template_lambda_policy" {
4949
]
5050
}
5151

52-
statement {
53-
sid = "AllowDynamoGSIAccess"
54-
effect = "Allow"
55-
56-
actions = [
57-
"dynamodb:Query",
58-
]
59-
60-
resources = [
61-
"${aws_dynamodb_table.templates.arn}/index/QueryById",
62-
]
63-
}
64-
6552
statement {
6653
sid = "AllowKMSAccess"
6754
effect = "Allow"

lambdas/backend-api/src/__tests__/templates/api/validate-letter-template-files.test.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,10 @@ describe('guard duty handler', () => {
103103

104104
await handler(event);
105105

106-
expect(mocks.templateRepository.get).toHaveBeenCalledWith(templateId, {
107-
clientId: clientId,
108-
});
106+
expect(mocks.templateRepository.get).toHaveBeenCalledWith(
107+
templateId,
108+
clientId
109+
);
109110

110111
expect(mocks.letterUploadRepository.download).toHaveBeenCalledWith(
111112
templateId,
@@ -354,9 +355,10 @@ describe('guard duty handler', () => {
354355

355356
await handler(event);
356357

357-
expect(mocks.templateRepository.get).toHaveBeenCalledWith(templateId, {
358-
clientId,
359-
});
358+
expect(mocks.templateRepository.get).toHaveBeenCalledWith(
359+
templateId,
360+
clientId
361+
);
360362

361363
expect(mocks.letterUploadRepository.download).toHaveBeenCalledTimes(1);
362364
expect(mocks.letterUploadRepository.download).toHaveBeenCalledWith(

lambdas/backend-api/src/__tests__/templates/app/template-client.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,7 +1431,7 @@ describe('templateClient', () => {
14311431

14321432
expect(mocks.templateRepository.get).toHaveBeenCalledWith(
14331433
templateId,
1434-
user
1434+
user.clientId
14351435
);
14361436

14371437
expect(result).toEqual({
@@ -1472,7 +1472,7 @@ describe('templateClient', () => {
14721472

14731473
expect(mocks.templateRepository.get).toHaveBeenCalledWith(
14741474
templateId,
1475-
user
1475+
user.clientId
14761476
);
14771477

14781478
expect(result).toEqual({
@@ -1507,7 +1507,7 @@ describe('templateClient', () => {
15071507

15081508
expect(mocks.templateRepository.get).toHaveBeenCalledWith(
15091509
templateId,
1510-
user
1510+
user.clientId
15111511
);
15121512

15131513
expect(result).toEqual({
@@ -1531,7 +1531,7 @@ describe('templateClient', () => {
15311531

15321532
const result = await templateClient.listTemplates(user);
15331533

1534-
expect(mocks.templateRepository.list).toHaveBeenCalledWith(user);
1534+
expect(mocks.templateRepository.list).toHaveBeenCalledWith(user.clientId);
15351535

15361536
expect(result).toEqual({
15371537
error: {
@@ -1576,7 +1576,7 @@ describe('templateClient', () => {
15761576

15771577
const result = await templateClient.listTemplates(user);
15781578

1579-
expect(mocks.templateRepository.list).toHaveBeenCalledWith(user);
1579+
expect(mocks.templateRepository.list).toHaveBeenCalledWith(user.clientId);
15801580

15811581
expect(result).toEqual({
15821582
data: [template],
@@ -1603,7 +1603,7 @@ describe('templateClient', () => {
16031603

16041604
const result = await templateClient.listTemplates(user);
16051605

1606-
expect(mocks.templateRepository.list).toHaveBeenCalledWith(user);
1606+
expect(mocks.templateRepository.list).toHaveBeenCalledWith(user.clientId);
16071607

16081608
expect(result).toEqual({
16091609
data: [template],

0 commit comments

Comments
 (0)