mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
Assume users are in enterprise commons if v1 affiliates lookup fails (#22728)
* updating affiliation check for enterprise commons to default to restricting wf on error * feat: simplify logic on affiliate lookup failure GitOrigin-RevId: ccd676af9a44413bf63fe7c1f7836080c2612f45
This commit is contained in:
committed by
Copybot
parent
5730fb993a
commit
5b8f6f83be
@@ -488,7 +488,10 @@ const _ProjectController = {
|
||||
affiliations: InstitutionsGetter.promises
|
||||
.getCurrentAffiliations(userId)
|
||||
.catch(err => {
|
||||
logger.error({ err, userId }, 'failed to get institution licence')
|
||||
logger.error(
|
||||
{ err, userId },
|
||||
'failed to get current affiliations'
|
||||
)
|
||||
return false
|
||||
}),
|
||||
subscription:
|
||||
@@ -1216,12 +1219,15 @@ const _ProjectController = {
|
||||
aiFeaturesAllowed,
|
||||
userIsMemberOfGroupSubscription
|
||||
) {
|
||||
let inEnterpriseCommons = false
|
||||
const affiliations = userValues.affiliations || []
|
||||
for (const affiliation of affiliations) {
|
||||
inEnterpriseCommons =
|
||||
inEnterpriseCommons || affiliation.institution?.enterpriseCommons
|
||||
}
|
||||
const affiliations = userValues.affiliations
|
||||
const affiliateLookupFailed = affiliations === false
|
||||
|
||||
// if affiliations is specifically false instead of empty, we know the affiliate lookup failed, and should defer to blocking auto-loading
|
||||
const inEnterpriseCommons =
|
||||
affiliateLookupFailed ||
|
||||
affiliations.some(
|
||||
affiliation => affiliation.institution?.enterpriseCommons
|
||||
)
|
||||
|
||||
// check if a user has never tried writefull before (writefull.enabled will be null)
|
||||
// if they previously accepted writefull, or are have been already assigned to a trial, user.writefull will be true,
|
||||
|
||||
Reference in New Issue
Block a user