Skip to content

Commit

Permalink
[OTE-438] Allow users to read data if they are in FIRST_STRIKE_CLOSE_…
Browse files Browse the repository at this point in the history
…ONLY (backport #1716) (#1725)

Co-authored-by: Christopher-Li <[email protected]>
  • Loading branch information
mergify[bot] and Christopher-Li authored Jun 18, 2024
1 parent f542b8b commit 255dbce
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,26 @@ describe('compliance-check', () => {
});
});

it.each([
['query', `/v4/check-compliance-query?address=${testConstants.defaultAddress}`],
['param', `/v4/check-compliance-param/${testConstants.defaultAddress}`],
])('does not return 403 if address in request is in FIRST_STRIKE_CLOSE_ONLY and from restricted country (%s)', async (
_name: string,
path: string,
) => {
isRestrictedCountrySpy.mockReturnValueOnce(true);
await ComplianceStatusTable.create({
...testConstants.compliantStatusData,
status: ComplianceStatus.FIRST_STRIKE_CLOSE_ONLY,
});
await sendRequestToApp({
type: RequestMethod.GET,
path,
expressApp: complianceCheckApp,
expectedStatus: 200,
});
});

it.each([
['query', `/v4/check-compliance-query?address=${testConstants.defaultAddress}`],
['param', `/v4/check-compliance-param/${testConstants.defaultAddress}`],
Expand Down
4 changes: 3 additions & 1 deletion indexer/services/comlink/src/lib/compliance-and-geo-check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ export async function complianceAndGeoCheck(
{ readReplica: true },
);
if (updatedStatus.length > 0) {
if (updatedStatus[0].status === ComplianceStatus.CLOSE_ONLY) {
if (updatedStatus[0].status === ComplianceStatus.CLOSE_ONLY ||
updatedStatus[0].status === ComplianceStatus.FIRST_STRIKE_CLOSE_ONLY
) {
return next();
} else if (updatedStatus[0].status === ComplianceStatus.BLOCKED) {
return create4xxResponse(
Expand Down

0 comments on commit 255dbce

Please sign in to comment.