overleaf/services/web/app/coffee/infrastructure/Features.coffee
Alasdair Smith 1160620afc Merge pull request #1278 from sharelatex/revert-1240-as-import-status-page
Revert "Import status page"

GitOrigin-RevId: aa667a7b158b38aeccc8251931cc20589dcb2bdd
2018-12-17 15:45:36 +00:00

33 lines
1,012 B
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?
else
throw new Error("unknown feature: #{feature}")