diff --git a/provider/storage-aws/src/main/java/org/opengroup/osdu/storage/provider/aws/security/UserAccessService.java b/provider/storage-aws/src/main/java/org/opengroup/osdu/storage/provider/aws/security/UserAccessService.java index 03f1b1a37bdab2270d637fec215c256de9e361e5..6cdc23b317b1a9105bc588839888ab2dd5a2a830 100644 --- a/provider/storage-aws/src/main/java/org/opengroup/osdu/storage/provider/aws/security/UserAccessService.java +++ b/provider/storage-aws/src/main/java/org/opengroup/osdu/storage/provider/aws/security/UserAccessService.java @@ -37,6 +37,7 @@ import org.springframework.stereotype.Service; public class UserAccessService { + public static final String RECORD_WRITING_ERROR_REASON = "Error on writing record"; @Inject private DpsHeaders dpsHeaders; @Inject @@ -115,9 +116,9 @@ public class UserAccessService { validateRecordAclsForServicePrincipal(records); } catch (InvalidACLException aclException) { throw new AppException( - HttpStatus.SC_FORBIDDEN, - "Invalid ACL", - String.format("ACL has invalid Group %s", aclException.getAcl())); + HttpStatus.SC_BAD_REQUEST, + RECORD_WRITING_ERROR_REASON, + String.format("Could not find group \"%s\".", aclException.getAcl())); } } } diff --git a/testing/storage-test-aws/src/test/java/org/opengroup/osdu/storage/records/TestIngestRecordNotFound.java b/testing/storage-test-aws/src/test/java/org/opengroup/osdu/storage/records/TestIngestRecordNotFound.java index e5a1fb4503253c4f55a9d8969425a53ff94b157c..88bb3487511c7a1dc203eb70e5fa3781473c187b 100644 --- a/testing/storage-test-aws/src/test/java/org/opengroup/osdu/storage/records/TestIngestRecordNotFound.java +++ b/testing/storage-test-aws/src/test/java/org/opengroup/osdu/storage/records/TestIngestRecordNotFound.java @@ -56,6 +56,6 @@ public class TestIngestRecordNotFound extends IngestRecordNotFoundTest { CloseableHttpResponse response = TestUtils.send("records", "PUT", HeaderUtils.getHeaders(TenantUtils.getTenantName(), testUtils.getToken()), record, ""); // it's a much simpler implementation to just check if the user is in the group that is being saved and if not to skip // per previous integration test requirements - TestUtils.getResult(response, HttpStatus.SC_FORBIDDEN, String.class); + TestUtils.getResult(response, HttpStatus.SC_BAD_REQUEST, String.class); } -} \ No newline at end of file +}