mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
465329527b
Skip Registration-Related Tests in OSS Codebase GitOrigin-RevId: 72647f6f54799145bf7bec93ad088c35ceae8fa6
71 lines
2.2 KiB
JavaScript
71 lines
2.2 KiB
JavaScript
/* eslint-disable
|
|
max-len,
|
|
*/
|
|
// TODO: This file was created by bulk-decaffeinate.
|
|
// Fix any style issues and re-enable lint.
|
|
/*
|
|
* decaffeinate suggestions:
|
|
* DS102: Remove unnecessary code created because of implicit returns
|
|
* DS207: Consider shorter variations of null checks
|
|
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
|
*/
|
|
let Features
|
|
const Settings = require('settings-sharelatex')
|
|
const fs = require('fs')
|
|
|
|
const publicRegistrationModuleAvailable = fs.existsSync(
|
|
`${__dirname}/../../../modules/public-registration`
|
|
)
|
|
|
|
module.exports = Features = {
|
|
externalAuthenticationSystemUsed() {
|
|
return (
|
|
Settings.ldap != null ||
|
|
Settings.saml != null ||
|
|
(Settings.overleaf != null ? Settings.overleaf.oauth : undefined) != null
|
|
)
|
|
},
|
|
|
|
hasFeature(feature) {
|
|
switch (feature) {
|
|
case 'homepage':
|
|
return Settings.enableHomepage
|
|
case 'registration':
|
|
return (
|
|
!Features.externalAuthenticationSystemUsed() ||
|
|
Settings.overleaf != null
|
|
)
|
|
case 'github-sync':
|
|
return Settings.enableGithubSync
|
|
case 'git-bridge':
|
|
return Settings.enableGitBridge
|
|
case 'custom-togglers':
|
|
return Settings.overleaf != null
|
|
case 'oauth':
|
|
return Settings.oauth != null
|
|
case 'templates-server-pro':
|
|
return Settings.overleaf == null
|
|
case 'affiliations':
|
|
case 'analytics':
|
|
// Checking both properties is needed for the time being to allow
|
|
// enabling the feature in web-api and disabling in Server Pro
|
|
// see https://github.com/overleaf/web-internal/pull/2127
|
|
return Settings.apis.v1 && !!Settings.apis.v1.url
|
|
case 'redirect-sl':
|
|
return Settings.redirectToV2 != null
|
|
case 'overleaf-integration':
|
|
return Settings.overleaf != null
|
|
case 'references':
|
|
return Settings.apis.references.url != null
|
|
case 'saml':
|
|
return Settings.enableSaml
|
|
case 'link-url':
|
|
return Settings.apis.linkedUrlProxy && Settings.apis.linkedUrlProxy.url
|
|
|
|
case 'public-registration':
|
|
return publicRegistrationModuleAvailable
|
|
default:
|
|
throw new Error(`unknown feature: ${feature}`)
|
|
}
|
|
}
|
|
}
|