overleaf/services/web/app/coffee/infrastructure/Features.coffee
Alasdair Smith 7112e65dc5 Merge pull request #1303 from sharelatex/project-import-refactor
Project import refactor

GitOrigin-RevId: b4edc35cd4a14db0f4e6746d3da28cd94c351117
2018-12-20 12:06:15 +00:00

35 lines
1.1 KiB
CoffeeScript

Settings = require 'settings-sharelatex'
module.exports = Features =
externalAuthenticationSystemUsed: ->
Settings.ldap? or Settings.saml? or Settings.overleaf?.oauth?
hasFeature: (feature) ->
switch feature
when 'homepage'
return Settings.enableHomepage
when 'registration'
return not Features.externalAuthenticationSystemUsed() or Settings.overleaf?
when 'github-sync'
return Settings.enableGithubSync
when 'git-bridge'
return Settings.enableGitBridge
when 'v1-return-message'
return Settings.accountMerge? and Settings.overleaf?
when 'custom-togglers'
return Settings.overleaf?
when 'publish-templates'
return true
when 'view-templates'
return !Settings.overleaf?
when 'affiliations'
return Settings?.apis?.v1?.url?
when 'rich-text'
isEnabled = true # Switch to false to disable
Settings.overleaf? and isEnabled
when 'redirect-sl'
return Settings.redirectToV2?
when 'force-import-to-v2'
return Settings.forceImportToV2
else
throw new Error("unknown feature: #{feature}")