Skip to content
Snippets Groups Projects
Commit f475d791 authored by Marc Burnie [AWS]'s avatar Marc Burnie [AWS]
Browse files

Fixing Status Code When Group Does Not Exist

parent f214cdb6
No related branches found
No related tags found
1 merge request!960Fixing Status Code When Group Does Not Exist
......@@ -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()));
}
}
}
......
......@@ -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
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment