Merge pull request #11621 from overleaf/jpa-targeted-access-check

[web] cut down volume of user content domain access check requests

GitOrigin-RevId: 42011325db9f421e8267c4d0215701dedae652f9
This commit is contained in:
Jakob Ackermann 2023-02-02 11:58:29 +00:00 committed by Copybot
parent c4ecded316
commit 635f2969ba

View file

@ -132,14 +132,22 @@ export async function checkUserContentDomainAccess() {
const userId = `0${randomHex(12).slice(1)}`
const buildId = genBuildId()
const zone = pickZone()
const urls = [
const urls = []
if (getMeta('ol-user_id')) {
// Logged-in user
urls.push(
`${getMeta(
'ol-compilesUserContentDomain'
)}/zone/${zone}/project/${projectId}/user/${userId}/build/${buildId}/output/output.pdf`,
)}/zone/${zone}/project/${projectId}/user/${userId}/build/${buildId}/output/output.pdf`
)
} else {
// Anonymous user
urls.push(
`${getMeta(
'ol-compilesUserContentDomain'
)}/zone/${zone}/project/${projectId}/build/${buildId}/output/output.pdf`,
]
)}/zone/${zone}/project/${projectId}/build/${buildId}/output/output.pdf`
)
}
const cases = []
for (const url of urls) {