overleaf/services/web/app/coffee/infrastructure/Features.coffee

36 lines
1.1 KiB
CoffeeScript
Raw Normal View History

2017-11-20 06:43:02 -05:00
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
2017-11-20 06:43:02 -05:00
when 'registration'
2018-09-25 03:29:34 -04:00
return not Features.externalAuthenticationSystemUsed() or Settings.overleaf?
2017-11-20 06:48:06 -05:00
when 'github-sync'
return Settings.enableGithubSync
when 'git-bridge'
return Settings.enableGitBridge
when 'v1-return-message'
return Settings.accountMerge? and Settings.overleaf? and !Settings.forceImportToV2
2018-03-22 08:10:34 -04:00
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'
2018-07-17 12:33:41 -04:00
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
2017-11-20 06:43:02 -05:00
else
throw new Error("unknown feature: #{feature}")